Last updated February 26, 2026
Heroku runs Java applications across a variety of Java implementations with support for framework-specific workflows. This document covers version support and configuration.
For details on how the Java buildpack builds and runs your application, see Heroku Java Behavior.
For framework-specific tutorials, see:
- Getting Started on Heroku with Java (Maven)
- Getting Started on Heroku with Java (Gradle)
- Java Tutorials
Specifying a Java Version
We recommend explicitly configuring the required OpenJDK major version for your application. If you don’t configure a version, the default version for the stack is installed. The default version changes over time and your application might fail to build with a new default.
The current default versions for each stack are:
heroku-22 |
heroku-24 |
|---|---|
| OpenJDK 8 | Latest LTS (currently OpenJDK 25) |
To explicitly configure the OpenJDK version, add a file called system.properties to your application. Within that file, set the java.runtime.version property to the OpenJDK major version for your app:
java.runtime.version=11
See the supported Java versions table for accepted major versions.
You can also pin your OpenJDK version to a full version. We don’t recommend this unless you have a strong reason to do so. Pinning to a full version prevents your app from automatically getting OpenJDK security updates on each build.
To use a full version, set the java.runtime.version property to the full version string:
java.runtime.version=1.8.0_482
Supported Java Versions
Refer to the table for the latest available version for each OpenJDK major version and Heroku stack. The selected OpenJDK version is bundled with your app and affects the final app size.
Rows marked up with red text and background indicate an OpenJDK version that is fully end-of-life and no longer receiving updates of any kind from the upstream maintainers and is no longer supported by Heroku.
| OpenJDK Version | heroku-22 |
heroku-24 |
|---|---|---|
| OpenJDK 7 | 1.7.0_352 | - |
| OpenJDK 8 | 1.8.0_482 | 1.8.0_482 |
| OpenJDK 11 | 11.0.30 | 11.0.30 |
| OpenJDK 13 | 13.0.14 | - |
| OpenJDK 15 | 15.0.10 | - |
| OpenJDK 17 | 17.0.18 | 17.0.18 |
| OpenJDK 18 | 18.0.2.1 | - |
| OpenJDK 19 | 19.0.2 | - |
| OpenJDK 20 | 20.0.2 | - |
| OpenJDK 21 | 21.0.10 | 21.0.10 |
| OpenJDK 22 | 22.0.2 | 22.0.2 |
| OpenJDK 23 | 23.0.2 | 23.0.2 |
| OpenJDK 24 | 24.0.2 | 24.0.2 |
| OpenJDK 25 | 25.0.2 | 25.0.2 |
Specifying an OpenJDK Distribution
Heroku supports builds of OpenJDK from either Azul® Zulu® or Heroku. Both distributions are built from the same source and are fully compliant with the Java SE specification. Azul® Zulu® builds of OpenJDK are also TCK/JCK certified and are our recommended OpenJDK distribution.
The default distribution of OpenJDK on Heroku is Azul® Zulu®.
Heroku’s builds of OpenJDK are only available for Cedar-generation apps.
Using a Non-default Distribution
To use a non-default distribution with your app, you must specify a Java version. Prefix the version string with either heroku- or zulu- to select the respective distribution.
To use OpenJDK 11 and explicitly select Azul® Zulu® as the OpenJDK distribution, add the following to system.properties:
java.runtime.version=zulu-11
Upgrading Your Java Version
When you deploy a Java app, the app automatically upgrades to the latest available OpenJDK version. The version doesn’t upgrade if you don’t redeploy the app or if you configure a full version string in the system.properties file.
Specifying a Maven Version
Heroku supports the Maven Wrapper, which is the recommended mechanism for defining a Maven version. If Heroku detects an mvnw file in the root directory of your repository, it uses this script to launch the Maven process.
You can also specify a Maven version with the system.properties file by setting a maven.version property:
maven.version=3.9.4
If you define this property, the buildpack ignores the mvnw script. The version isn’t upgraded automatically and you must update your system.properties file to get a new version.
The default Maven version, if you don’t specify one and don’t use Maven Wrapper, is 3.9.4. This default changes over time. We recommend using Maven Wrapper to ensure stable builds.
See the Working with Maven category for more info on Maven.
Default Web Process Type
If your app doesn’t have a Procfile, the buildpack creates a default web process type for recognized frameworks. Spring Boot, Micronaut, and Quarkus are detected automatically.
For Spring Boot, the default process type is:
java -Dserver.port=$PORT -jar target/<app>.jar
You can override this by defining your own web process type in a Procfile.