JDK (OpenJDK)
Installs: OpenJDK 17/21/25 (apt) -> /usr/lib/jvm, Maven, Gradle. Toolchain id: java.
Install
Section titled “Install”Preview the install with the default options. This prints every script it would run and changes nothing:
npx linux-toolchain --only java --defaults --dry-runSet an option with --opt instead of its default:
npx linux-toolchain --only java --opt java.jdk=17,21 --defaults --dry-runRemove --dry-run to install for real. Without --defaults, the options below are asked interactively. bunx linux-toolchain takes the same arguments.
Options
Section titled “Options”Set with --opt java.<key>=<value>. Multi options take a comma list (an empty value means none); yes/no options take true or false.
| Option | Kind | Choices | Default |
|---|---|---|---|
java.jdkJDK versions |
multi (comma list, at least 1) | 17 OpenJDK 17 (LTS)21 OpenJDK 21 (LTS)25 OpenJDK 25 (LTS) |
21 |
java.defaultDefault JDK |
select (one value) | 17 OpenJDK 1721 OpenJDK 2125 OpenJDK 25 |
21 |
java.addonsAdd-ons |
multi (comma list) | see Add-ons | maven,gradle |
Add-ons
Section titled “Add-ons”Chosen in the add-ons step or with --opt java.addons=.... Recommended add-ons are pre-checked and installed with --defaults. A failed add-on is reported as a warning; the toolchain itself still succeeds.
mavenMaven (apt) Default.gradleGradle (latest zip -> /opt/gradle) Default.jenv(selects the jenv component) Also selects thejenvtoolchain.
Dependencies
Section titled “Dependencies”- The add-on
jenvselects thejenvtoolchain, which is then asked about too.--opt jenv.<key>=<value>may target it.
Back to the toolchain reference. Run npx linux-toolchain list to print the catalog of the version you have.