Which Java Version Does Your Minecraft Server Need?
"Unsupported class file major version" and a server that won't start after an update are almost always a Java mismatch, not a corrupted install. Here's the exact table.
Older 1.12.2-era tech/magic packs like SevTech: Ages are a frequent source of Java-8-specific requirements — a modern JRE won't always run them cleanly.
Quick reference table
| Minecraft version | Java version |
|---|---|
| 1.20.5 and newer (incl. all 2026 releases) | Java 21 |
| 1.18 – 1.20.4 | Java 17 |
| 1.17.x | Java 16 (17 also works) |
| 1.12 – 1.16.5 (esp. modded) | Java 8 |
The error that sends people here
If your console shows "Unsupported class file major version" followed by a number, or the server simply refuses to start with no world-load messages at all after updating Minecraft or a mod, this is a Java version mismatch — the server jar was built for a newer (or sometimes older) Java release than what's actually running it.
The version table — match it exactly
Minecraft 1.20.5 and newer (including all 2026 releases): Java 21. Minecraft 1.18 through 1.20.4: Java 17. Minecraft 1.17.x: Java 16 (Java 17 also works for 1.17 in practice, but 16 is what Mojang shipped it against). Minecraft 1.12 through 1.16.5: Java 8 (modded 1.12/1.16 packs in particular are frequently still built against 8 specifically — some mods break on anything newer). Always match the Minecraft version, not the modpack's "recommended" label, which can be stale.
Check what your server is actually running
Run `java -version` in the same shell/session your server process starts from — not just whatever `java` resolves to in your personal terminal, which can differ if multiple JREs are installed. On a panel host, the install logs or a Files-tab console usually print the exact JRE path and version at boot.
Newer Java than the server jar needs is usually fine
Running Java 21 against an old 1.16 server jar generally still works — the JVM is backward compatible with older class file versions. The actual failure case is the reverse: a server jar compiled for a newer Java (common with modern Forge/NeoForge/Paper builds targeting 1.20.5+) running on an older JRE. That's what throws "Unsupported class file major version" — the runtime literally cannot read bytecode from a newer spec than it implements.
Modded servers: check mod-level requirements too, not just the loader
Forge, NeoForge and Fabric all publish their own minimum Java version per loader release, and individual mods can tighten that further (a mod compiled against Java 21 features will fail on Java 17 even if the loader itself would run). If the loader starts but a specific mod throws a `NoClassDefFoundError` or `UnsupportedClassVersionError` immediately, check that mod's own listed Java requirement before assuming the whole pack is misconfigured.
Switching Java versions without reinstalling the server
On Linux, multiple JDKs can coexist — install the target version via your package manager (or `sdk install java` with SDKMAN) and point your start script's `java` invocation at the specific binary (e.g. `/usr/lib/jvm/java-21-openjdk/bin/java -jar server.jar`) rather than relying on `$PATH` or `update-alternatives`, which can get silently overridden by future package installs.
FAQ
What Java version does Minecraft 1.21 need?+
Java 21. This applies to every Minecraft release from 1.20.5 onward, including all of the 1.21.x line and 2026's releases.
Can I just install the newest Java and be safe for every Minecraft version?+
Mostly, but not entirely — a newer JRE can usually run an older server jar (bytecode is backward compatible), but some older modded packs (especially 1.12.2 and 1.16.5) specifically require Java 8 because certain mods from that era use APIs removed or changed in later Java releases. Match the table for modded servers rather than assuming "newest is always safest."
What does "Unsupported class file major version" actually mean?+
It means the server jar (or a mod/plugin jar) was compiled targeting a newer Java specification than the JRE currently trying to run it implements. The fix is always to upgrade the JRE to match what the jar needs — there's no server-side setting that works around it.
Do I need the JDK or just the JRE to run a Minecraft server?+
The JRE (Java Runtime Environment) is sufficient to run a server — the JDK (which includes a compiler) is only needed if you're building something from source yourself. Most distro packages labeled "openjdk" without further qualification install the full JDK anyway, which works fine, just isn't strictly required.
My modpack launcher says it needs a specific Java version but my server host runs something else — what do I do?+
Server-side Java requirements follow the Minecraft/loader version table, not the client launcher's bundled runtime — client launchers often bundle their own Java independent of what the dedicated server actually needs. Use this guide's table for the server; ignore what the client-side launcher ships.
The right Java version, every time, automatically
CoalHost matches the JRE to your Minecraft version and loader at install time — no manual JDK juggling, ever. From €10.69/month.
View Minecraft Hosting →