Unsupported Class File Major Version: Fix the Wrong Java Error
You start the server, it prints a few lines, and then it stops with something like Unsupported class file major version 65 or has been compiled by a more recent version of the Java Runtime. It looks scary, but it is one of the easiest startup errors to fix. The server is running on the wrong version of Java, and the number in the error tells you which one it wanted.
What the number means
Every Java program is compiled into "class files", and each class file is stamped with a version number. A Java runtime can only read class files up to its own number. Minecraft, the server jar, mod loaders and mods are all compiled this way, so when the numbers don't line up, Java refuses to load them.
| Class file version | Java version |
|---|---|
| 52 | Java 8 |
| 55 | Java 11 |
| 60 | Java 16 |
| 61 | Java 17 |
| 65 | Java 21 |
| 69 | Java 25 |
The pattern is simple: subtract 44 from the class file number and you get the Java version. So 65.0 means Java 21 and 69.0 means Java 25.
Which Minecraft versions need which Java
| Minecraft version | Java to use |
|---|---|
| 1.16.5 and older (especially Forge packs) | Java 8 |
| 1.17.x | Java 16 or 17 |
| 1.18 to 1.20.4 | Java 17 |
| 1.20.5 to 1.21.x | Java 21 |
| 26.1 and newer | Java 25 |
Mojang moved to Java 25 with the 26.1 release, so every current version (26.1, 26.2, 26.3) needs Java 25. For the full breakdown, including Forge and Fabric quirks, see which Java version your server needs.
The two versions of this error
The same problem shows up with two different messages, and they point in opposite directions. Read the exact wording before you change anything.
Error A: "compiled by a more recent version" (Java is too old)
Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
Read it as: "this file needs Java 21 (65), but you are running Java 17 (61)." The fix is to install the newer Java and start the server with it.
This is what you see when you update a server from 1.20.4 to 1.21, or from 1.21.x to 26.1, and forget to update Java. The class name in the message may be the server jar, a plugin, or a mod, but the fix is the same.
If the class named in the error is a plugin or mod rather than the server itself, that one add-on was built for a newer Java than your server runs. Either update Java (if your Minecraft version supports it) or download an older build of that add-on made for your version.
Error B: "Unsupported class file major version" (Java is usually too new)
java.lang.IllegalArgumentException: Unsupported class file major version 65
This message comes from a tool that mod loaders and some plugin loaders use to read and patch code. Older versions of that tool only understand class files up to a certain version. If you run an old Forge pack on a brand new Java, the tool tries to read Java's own files, sees a version number it has never heard of, and gives up.
Common examples:
- A Forge 1.12.2 or 1.16.5 pack started with Java 17 or 21. These packs want Java 8.
- A Forge 1.19.2 or 1.20.1 pack started with Java 25. Those packs want Java 17.
A clue: if the line around the error mentions a core Java class like java/lang/Object or java/lang/Thread, it is reading Java itself, which means your Java is newer than the loader supports. Switch to the older Java from the table above.
Less often, Error B appears because one mod or plugin jar was compiled for a newer Java than the loader's patching tool understands. If the server runs the correct Java for its version and the error still names one specific mod, that mod build is too new for your setup. Download the build made for your exact Minecraft and loader version.
How to check which Java you have
On your own computer, open a terminal (Command Prompt on Windows) and run:
java -version
You will see something like openjdk version "21.0.5". The first number is the Java version.
Be careful: this shows the Java your system uses by default, which is not always the one your server starts with. Many PCs have several Java versions installed, and launchers bring their own. The most reliable check is the server's own output. Paper and the mod loaders print the Java version near the top of logs/latest.log, and the error itself tells you the highest version your runtime supports ("only recognizes class file versions up to 61.0" means Java 17).
How to fix it
On a home PC
- Install the Java version you need. Eclipse Temurin from adoptium.net offers free builds of Java 8, 17, 21 and 25.
- Edit your start script so it points at that exact Java instead of the default one. On Windows that looks like:
"C:\Program Files\Eclipse Adoptium\jdk-21.0.5.11-hotspot\bin\java.exe" -Xmx4G -jar server.jar nogui
The folder name depends on the exact version you installed, so check it in File Explorer and copy the real path.
- Start the server and check the first lines of the console for the new Java version.
Using the full path means you can keep several Java versions installed and give each server the one it needs.
On a server host
Most hosting panels have a Java or "Docker image" setting on the startup or settings page. Pick the version from the table above, then restart. If you just changed the Minecraft version, change Java in the same step. See how to change your server's Minecraft version for the full checklist.
For modpacks
Modpack pages on CurseForge and Modrinth list the Minecraft version, and that decides the Java version. A 1.20.1 pack needs Java 17 even if the pack was released last month. A 1.21.1 pack needs Java 21. Don't guess from the release date, go by the Minecraft version.
Still not starting?
If Java is now correct and the server still stops, the error has changed and you need to read the new one. These posts cover the next most likely problems:
- Forge server won't start for loader and mod issues.
- Server closes immediately for EULA, RAM and script problems.
- How to read a crash report when the log is a wall of text.
On FreaksMC, the server picks a matching Java version (8, 17, 21 or 25) automatically each time it starts, so this error mostly comes up there only when a single mod or plugin was built for a newer Java than its Minecraft version.
Want a server that just runs fast?
FreaksMC servers run on AMD Ryzen 9 7950X3D processors with fast NVMe storage. Pick vanilla, Paper or a modpack and your server is ready in minutes.
See plans from $4/mo