Fix Minecraft "UnsupportedClassVersionError" (Wrong Java Version)
UnsupportedClassVersionErrorcompiled by a more recent version of Javaclass file versionThis error means your server jar needs a newer Java than the one running it. Modern Minecraft needs modern Java — here's how to match them.
What the error means
UnsupportedClassVersionError ... compiled by a more recent version of the Java Runtime means the server jar was built for a newer Java than you have installed. The fix is simply installing and using the right Java version.
Which Java does my Minecraft need?
- Minecraft 1.20.5+ / 1.21 — Java 21.
- Minecraft 1.18 – 1.20.4 — Java 17.
- Minecraft 1.17 — Java 16.
- Minecraft 1.16.5 and older — Java 8.
Install the right Java
Install a modern JDK (Temurin/Adoptium is a good choice), then verify the version:
# Debian/Ubuntu example
apt install temurin-21-jdk
java -version # should report 21
Point the server at it
If you have several Java versions, call the right one explicitly in your start script instead of the system default:
/usr/lib/jvm/temurin-21-jdk/bin/java -Xmx4G -jar server.jar nogui
Running an old 1.12 modpack? It needs Java 8 — newer Java will break it. Match Java to the Minecraft version, not "newest is best".
The jar needs newer Java than you have. Match Java to the Minecraft version (1.21 needs Java 21) and call it explicitly in the start script.
Minecraft is a trademark of Mojang Synergies AB / Microsoft. ESAGAMES is an independent hosting provider, not affiliated with or endorsed by Mojang or Microsoft.
Java handled automatically
Our Minecraft hosting runs the correct Java for your version out of the box — one-click setup, protected in Frankfurt.
Frequently asked questions
What Java version does Minecraft 1.21 need?
Java 21. Minecraft 1.20.5 and newer require Java 21; 1.18–1.20.4 need Java 17; 1.17 needs 16; and 1.16.5 or older run on Java 8.
What causes "UnsupportedClassVersionError"?
The server jar was compiled for a newer Java than the one running it. Install the Java version that matches your Minecraft version and start the server with it.
Can I just install the newest Java for everything?
No — older versions and old modpacks (e.g. 1.12) need Java 8 and break on newer Java. Always match the Java version to the Minecraft version you're running.
Related articles
Fix AMX Mod X "Couldn't load library" / Plugin Failed in CS 1.6
AMXX plugin stuck on "bad load", "couldn't load library" or "failed"? The real causes and the exact fix.
Read fix Game ServersFix FiveM "Couldn't load resource" / Failed to Start
A FiveM resource won't start or throws "couldn't load resource"? Here are the real causes and fixes.
Read fix Game ServersFix Rust Oxide / uMod Plugins Not Loading
Oxide/uMod plugins not loading after a Rust update? The usual causes and the quick fix.
Read fix