Java: Difference between revisions

imported>Brhoades
m changed openjdk example versions
updated package names and versions
Line 9: Line 9:
== JDK options ==
== JDK options ==


Your default choice should probably be to install <code>jdk17</code>, which is an alias for <code>openjdk17</code>. If you're in a server environment, go for <code>jdk17_headless</code>. Java 17 is the currently-maintained LTS version of OpenJDK as of March 2021.
Your default choice should probably be to install <code>jdk</code>, which is an alias the latest LTS. If you're in a server environment, go for <code>jdk21_headless</code>. Java 21 is the currently-maintained LTS version of OpenJDK as of April 2024.


As you might expect, though, many flavors of Java are available in NixOS.
As you might expect, though, many flavors of Java are available in NixOS.


* OpenJDK, by far the most popular non-Oracle JVM implementation
* OpenJDK, by far the most popular non-Oracle JVM implementation
** <code>openjdk8[_headless]</code> for a legacy Java 8 VM required by some older apps
** <code>jdk8[_headless]</code> for a legacy Java 8 VM required by some older apps
** <code>openjdk17[_headless]</code>, the currently-supported LTS version of OpenJDK
** <code>jdk21[_headless]</code>, the currently-supported LTS version of OpenJDK
** <code>openjdk19[_headless]</code>, the current version of OpenJDK
** <code>jdk22[_headless]</code>, the current version of OpenJDK
* AdoptOpenJDK, prebuilt binaries for OpenJDK
* Temurin, formerly AdoptOpenJDK, prebuilt binaries for OpenJDK
** <code>adoptopenjdk-bin</code> points to the latest version of AdoptOpenJDK, which is version 11 at the time of writing.
** <code>temurin-bin</code> points to the latest version of Temurin, which is version 21 at the time of writing.
** <code>adoptopenjdk-jre-bin</code> is available if you want to avoid downloading the compiler and only require the runtime environment.
** <code>temurin-jre-bin</code> is available if you want to avoid downloading the compiler and only require the runtime environment.
** <code>adoptopenjdk{,-jre}-openj9-bin-{8,17,19}</code> same, but using [https://en.wikipedia.org/wiki/OpenJ9 Eclipse OpenJ9] instead of HotSpot as its JVM.
* JetBrains JDK (<code>jetbrains.jdk</code>), a fork of OpenJDK with modifications made by JetBrains
* JetBrains JDK (<code>jetbrains.jdk</code>), a fork of OpenJDK with modifications made by JetBrains
* Oracle's JDK (<code>oraclejdk</code>), only version 8 is available.
* Oracle's JDK (<code>oraclejdk</code>), only version 8 is available.