Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions topics/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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.version in system.properties. [1]

  • heroku-24 (current stack): default is Latest LTS (currently OpenJDK 25). Heroku changed the heroku-24 default from 21 → 25 effective September 17, 2025. [1][2]
  • heroku-22: default is OpenJDK 8. [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 (or 25). [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:

  • heroku-24 (current): defaults to OpenJDK 25 (changed from 21 → 25 effective September 17, 2025)
  • heroku-22 (older): defaults to OpenJDK 8

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.properties if they require a specific Java version different from the stack default.

🤖 Prompt for AI Agents
In `@topics/heroku.md` at line 68, Update the sentence that currently claims "By
default, Heroku uses Java 8..." to reflect current Heroku defaults: state that
heroku-24 (current) defaults to OpenJDK 25 while heroku-22 defaults to OpenJDK
8, and clarify that a system.properties file is only required when you need a
Java version different from the stack default; modify the paragraph in
topics/heroku.md that contains the original sentence so it either targets a
specific stack (heroku-24) or replaces the default claim with "heroku-24
defaults to OpenJDK 25 (heroku-22 defaults to OpenJDK 8)" and add the clarifying
sentence about system.properties.

Copy link
Collaborator

Choose a reason for hiding this comment

The 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
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.
By default, Heroku uses Java 25 to run your application. If your Ktor application is compiled with a different Java version, you need to specify it explicitly to avoid deployment failures.


To specify the Java version, create a `system.properties` file in the project root and add the following content:
```
java.runtime.version=11
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
java.runtime.version=11
java.runtime.version=21

```
{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"}

Expand Down