NewSchokr 13 is here. A whole new UI, seven locations, snapshots and more. Read more →

Fix Java version errors (UnsupportedClassVersionError) on Minecraft

Fix UnsupportedClassVersionError and other Java version mismatch errors by matching your server's Java version to your Minecraft version.

Updated · 2 min read

Each Minecraft version needs a specific Java version. If the server, a plugin or a mod was built for a newer Java than the server runs, startup fails with UnsupportedClassVersionError. If you run a very old Minecraft version on a new Java, you get different errors. The fix is to run the Java version that matches your Minecraft version.

The typical error

java.lang.UnsupportedClassVersionError: io/papermc/paper/PaperBootstrap 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

Translate the class file numbers to Java versions:

Class file versionJava version
52Java 8
55Java 11
60Java 16
61Java 17
65Java 21

In the example, the server jar needs Java 21 (65.0) but the server is running Java 17 (61.0).

If the class named in the error belongs to a plugin or mod rather than the server, that single plugin or mod needs a newer Java. Either get a build of it for your Java and Minecraft version, or upgrade both.

Which Java for which Minecraft version

General guidance for recent versions:

Minecraft versionJava version
1.20.5 and newerJava 21
1.18 to 1.20.4Java 17
1.17Java 16 (17 also works)
1.16.5 and olderJava 8 (some versions also run on 11)

The newest Minecraft releases can raise the requirement again, so check the version's page on the Minecraft Wiki or the Paper documentation when you upgrade.

Errors from Java that is too new

Older Minecraft versions, and especially old Forge versions, break on newer Java. A common example with old Forge:

java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast
to class java.net.URLClassLoader

This means Forge for an old Minecraft version is running on Java 9 or newer. It needs Java 8.

How to change Java on Schokr

  1. Stop the server.
  2. Open your server's Startup settings.
  3. If the template lets you choose the Java version (often shown as the Docker image or Java version option), pick the one that matches your Minecraft version from the table above.
  4. Start the server and confirm the error is gone. The startup log shows the Java version in use.

If you do not see a way to choose the Java version for your server, ask in the Schokr Discord.

When you changed Minecraft version

This error often appears right after moving a server to a newer or older Minecraft version. Whenever you change versions:

  1. Take a snapshot first.
  2. Match the Java version to the new Minecraft version.
  3. Update plugins or mods to builds for the new version.

Players see Java errors too

Players' launchers handle Java for them in most cases. If a player gets a Java error launching a modded client, they should update their launcher or let it choose the Java version automatically. That is separate from the server's Java.