Java 17 for Minecraft Servers
Minecraft servers from 1.18 to 1.20.4 require Java 17 or newer (class file version 61), according to Mojang's version data. Eclipse Temurin 17 is a free, widely used build.
Minecraft versions that need Java 17
According to Mojang's version data, these Minecraft releases require Java 17 as the minimum (newer Java versions also work for vanilla and Paper-family servers):
1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18
Snapshots and pre-releases of these versions have the same requirement. Full table: Minecraft → Java versions.
Install Java 17 (Eclipse Temurin)
Temurin is a free OpenJDK build from the Eclipse Adoptium project. Download installers from adoptium.net — Temurin 17 , or use a package manager:
REM Windows (winget) winget install EclipseAdoptium.Temurin.17.JDK # macOS (Homebrew) brew install --cask temurin@17 # Debian/Ubuntu — after adding the Adoptium apt repository (see below) sudo apt install temurin-17-jdk
Adding the Adoptium apt repository (from Adoptium's installation docs):
sudo apt install -y wget apt-transport-https gpg
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update
sudo apt install temurin-17-jdkA server only needs the runtime, so temurin-17-jre also works (its folder is then temurin-17-jre-amd64); the commands here use the JDK for consistency. Other distributions (dnf, zypper, apk): see Adoptium's Linux instructions.
Check it and use it for your server
Open a new terminal and run java -version. For Java 17 the first line starts with openjdk version "17.. If another version appears, your PATH points to a different Java — call the right one by full path in your start script:
REM Windows: see dir "C:\Program Files\Eclipse Adoptium" for the exact folder "C:\Program Files\Eclipse Adoptium\jdk-17…-hotspot\bin\java.exe" -Xms4G -Xmx4G -jar server.jar nogui # macOS "$(/usr/libexec/java_home -v 17)/bin/java" -Xms4G -Xmx4G -jar server.jar nogui # Linux (Adoptium packages; check: ls /usr/lib/jvm) /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Xms4G -Xmx4G -jar server.jar nogui
On Debian/Ubuntu you can instead switch the system default with sudo update-alternatives --config java. The start script generator writes a script that checks the Java version first.
Error message for Java 17 jars
A server jar that needs Java 17, started with an older Java, fails with UnsupportedClassVersionError mentioning class file version 61.0:
… has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to …
Install Java 17 as above and make sure the start script uses it. Walkthrough: fix UnsupportedClassVersionError.