Which Java Version for Your Minecraft Server?
The Java version each Minecraft release needs, and how to fix UnsupportedClassVersionError.
December 5, 20263 min read
The table
| Minecraft version | Java |
|---|---|
| 1.16.5 and older | Java 8 |
| 1.17 | Java 16 or newer |
| 1.18 to 1.20.4 | Java 17 |
| 1.20.5 to 1.21.x | Java 21 |
| 26.1 and newer | Java 25 |
UnsupportedClassVersionError
The message means the jar was built for a newer Java than the one running it. The "class file version" tells you which: 52 is Java 8, 61 is Java 17, 65 is Java 21, 69 is Java 25.
Select the matching Java image in your server's startup settings, then restart.
Old modpacks
Many 1.12.2 and older modpacks require Java 8 and crash on newer versions. Keep the version the pack asks for.