-
Notifications
You must be signed in to change notification settings - Fork 369
docs: add Java version configuration for Heroku deployment (KTOR-6492) #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -63,6 +63,18 @@ web: ./build/install/ktor-get-started-sample/bin/ktor-get-started-sample | |||||
| This file specifies a path to the application's executable generated by the [stage](#stage) task and allows Heroku to start the application. | ||||||
| You might need to replace `ktor-get-started-sample` with you project name. | ||||||
|
|
||||||
| ### Step 4: Specify Java version (optional) {id="java-version"} | ||||||
|
|
||||||
| By default, Heroku uses Java 8 to run your application. If your Ktor application is compiled with Java 11 or higher, you need to explicitly specify the Java runtime version to avoid deployment failures. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far I can see, by default, the app will be built on the heroku-24 stack, which uses OpenJDK 25.
Suggested change
|
||||||
|
|
||||||
| To specify the Java version, create a `system.properties` file in the project root and add the following content: | ||||||
| ``` | ||||||
| java.runtime.version=11 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A newly generated Ktor project will use JDK 21, so I suggest using this version instead:
Suggested change
|
||||||
| ``` | ||||||
| {style="block"} | ||||||
|
|
||||||
| You can replace `11` with your desired Java version (e.g., `17`, `21`). For more information, see [Specifying a Java version](https://devcenter.heroku.com/articles/java-support#specifying-a-java-version) in the Heroku documentation. | ||||||
|
|
||||||
|
|
||||||
| ## Deploy an application {id="deploy-app"} | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Heroku default Java version 2025 2026 runtime💡 Result:
On Heroku, the default Java (OpenJDK) version depends on the stack, and it’s used only if you don’t set
java.runtime.versioninsystem.properties. [1]As of January 21, 2026, the default patch levels include OpenJDK 25.0.2 (plus updated 21/17/11/8 patch releases). [3]
To avoid surprise upgrades, pin a version by adding
system.properties, e.g.java.runtime.version=21(or25). [1]Sources: [1] [2] [3]
Update Java version claim to reflect current Heroku defaults.
The documentation states Heroku defaults to Java 8, but this is inaccurate as of February 2026. Heroku's default Java version depends on the stack:
Since most applications deploy to heroku-24, the documentation should either specify which stack it targets or update the default claim to reflect OpenJDK 25. Clarify that users only need
system.propertiesif they require a specific Java version different from the stack default.🤖 Prompt for AI Agents