Java 8 for Minecraft Servers

Minecraft servers from 1.2.5 to 1.16.5 require Java 8 or newer (class file version 52), according to Mojang's version data. Eclipse Temurin 8 is a free, widely used build.

Minecraft versions that need Java 8

According to Mojang's version data, these Minecraft releases require Java 8 as the minimum (newer Java versions also work for vanilla and Paper-family servers):

1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9, 1.8.8, 1.8.7, 1.8.6, 1.8.5, 1.8.4, 1.8.3, 1.8.2, 1.8.1, 1.8, 1.7.10, 1.7.9, 1.7.8, 1.7.7, 1.7.6, 1.7.5, 1.7.4, 1.7.3, 1.7.2, 1.6.4, 1.6.2, 1.6.1, 1.5.2, 1.5.1, 1.4.7, 1.4.6, 1.4.5, 1.4.4, 1.4.2, 1.3.2, 1.3.1, 1.2.5

Modded servers of this era (Forge 1.16.5 and older, including 1.12.2 and 1.7.10) generally expect Java 8 itself rather than a newer Java.

Snapshots and pre-releases of these versions have the same requirement. Full table: Minecraft → Java versions.

Install Java 8 (Eclipse Temurin)

Temurin is a free OpenJDK build from the Eclipse Adoptium project. Download installers from adoptium.net — Temurin 8 , or use a package manager:

REM Windows (winget)
winget install EclipseAdoptium.Temurin.8.JDK

# macOS (Homebrew)
brew install --cask temurin@8

# Debian/Ubuntu — after adding the Adoptium apt repository (see below)
sudo apt install temurin-8-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-8-jdk

A server only needs the runtime, so temurin-8-jre also works (its folder is then temurin-8-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 8 the first line starts with openjdk version "1.8.0_. 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-8…-hotspot\bin\java.exe" -Xms4G -Xmx4G -jar server.jar nogui

# macOS
"$(/usr/libexec/java_home -v 1.8)/bin/java" -Xms4G -Xmx4G -jar server.jar nogui

# Linux (Adoptium packages; check: ls /usr/lib/jvm)
/usr/lib/jvm/temurin-8-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 8 jars

A server jar that needs Java 8, started with an older Java, fails with UnsupportedClassVersionError mentioning class file version 52.0:

… has been compiled by a more recent version of the Java Runtime (class file version 52.0), this version of the Java Runtime only recognizes class file versions up to …

Install Java 8 as above and make sure the start script uses it. Walkthrough: fix UnsupportedClassVersionError.