This 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 and avoid it again after your next version upgrade.
Quick answer
"UnsupportedClassVersionError" means your Minecraft server jar needs a newer Java than the one running it. Minecraft 1.20.5 and newer need Java 21, 1.18 to 1.20.4 need Java 17, and 1.16 and older run on Java 8. Install the right Java version and point your start script or control panel at it.
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?
Match your Minecraft version to the Java it was built for — this table covers the modern releases:
| Minecraft version | Java required |
|---|---|
| 1.20.5+ / 1.21 | Java 21 |
| 1.18 – 1.20.4 | Java 17 |
| 1.17 | Java 16 |
| 1.16.5 and older | Java 8 |
"UnsupportedClassVersionError" always means Java is too old for the jar. Match the table rather than just grabbing the newest Java, though: modern versions (1.17+) are happy on Java 17/21, but old Minecraft (1.16.5 and earlier) genuinely needs Java 8 and can misbehave on newer runtimes. Use the version the table lists.
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 21Point 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 noguiRunning 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.
Managing multiple Java versions on one machine
If you run several servers on different Minecraft versions on the same box, install each required JDK side by side and reference the full binary path per server rather than relying on the system default — that's what stops one server's Java update from breaking another. On Debian/Ubuntu, update-alternatives --list java shows every JDK installed, and update-alternatives --config java lets you pick the system default interactively.
Related errors
If the server starts but then runs out of memory, see fixing Minecraft "out of memory" (Java heap space) and how to allocate more RAM to a Minecraft server. If it starts fine but lags under load, see fixing "Can't keep up! Is the server overloaded?".
Minecraft is a trademark of Mojang Synergies AB / Microsoft. ESAGAMES is an independent hosting provider, not affiliated with or endorsed by Mojang or Microsoft.