Fix Java Version Errors on Minecraft Servers
Resolve Java version errors on Minecraft servers, UnsupportedClassVersionError, install the correct JDK, manage multiple Java versions and configure your start script.
The Error
If you see UnsupportedClassVersionError or has been compiled by a more recent version of the Java Runtime (class file version 65.0) when starting your Minecraft server, your installed Java version is too old for the server jar. This is the most common minecraft java version error fix scenario.
Java Version Requirements by Minecraft Version
| Minecraft Version | Minimum Java | Recommended Java |
|---|---|---|
| 1.21+ | Java 21 | Java 21 (Temurin/Adoptium) |
| 1.18, 1.20.6 | Java 17 | Java 17 or 21 |
| 1.17 | Java 16 | Java 17 |
| 1.12, 1.16.5 | Java 8 | Java 8 or 11 |
Class file version numbers map to Java releases: 65 = Java 21, 61 = Java 17, 60 = Java 16, 52 = Java 8. The error message tells you exactly which version is needed.
Installing the Correct Java Version
Debian / Ubuntu
# Add Adoptium repository
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
echo "deb https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update
sudo apt install temurin-21-jre
CentOS / RHEL / Fedora
sudo yum install java-21-openjdk
Windows
Download the Temurin 21 installer from adoptium.net and run it. Make sure to check "Set JAVA_HOME" during installation.
Managing Multiple Java Versions
If you run multiple servers on different Minecraft versions, you need multiple Java installations. On Linux:
# List installed alternatives
sudo update-alternatives --config java
# Or use the full path in your start script:
/usr/lib/jvm/temurin-21-jre/bin/java -Xmx4G -jar paper.jar nogui
Using the full path is the most reliable approach, it avoids any ambiguity about which Java runs your server.
Hosting Panel Users
If you use a game hosting panel (Pterodactyl, Multicraft, etc.), look for a "Java Version" or "Docker Image" selector in your server settings. Select the image that includes Java 21 for Minecraft 1.21+. If your panel does not offer Java 21, contact your hosting provider, they need to update their images.
Verifying the Fix
After installing the correct Java version, run:
java -version
You should see output like openjdk version "21.0.x". Then start your server again. The minecraft java version error fix is complete when the server boots without class version errors.
If the server still won't start after fixing Java, check our general startup troubleshooting guide.
Need reliable hosting that handles these issues out of the box? Astroworld Hosting runs optimised Paper servers on NVMe SSDs with 24/7 support.