The problem
Fix UnsupportedClassVersionError and other crashes caused by running Minecraft or a mod loader on the wrong Java version.
Possible causes
- The game or a mod needs a newer Java than the one being used.
- An old Minecraft version (1.16.5 and earlier with Forge) running on a Java that is too new.
- The launcher points to a system Java instead of the right runtime.
How to identify the cause
- "class file version 61.0" means the code needs Java 17; 65.0 means Java 21; 69.0 means Java 25; 52.0 means Java 8.
- The first lines of
latest.logshow which Java version the game started with. AppClassLoader cannot be cast to class java.net.URLClassLoadermeans an old Forge is running on Java 9 or newer.
Step-by-step fix
- Find the Java version your Minecraft version needs. See Java versions for Minecraft.
- In the official launcher, leave the Java runtime on the bundled default unless a modpack says otherwise.
- In Prism Launcher or similar, set the Java path per instance in its settings.
- Install the required Java from a trusted vendor such as Eclipse Temurin or Microsoft Build of OpenJDK if your launcher does not provide it.
- Launch again and check the Java version at the top of the new log.
If that did not work
- If one mod needs a newer Java than your old Minecraft version supports, that mod build is for a newer version. Find the build for your version.
Affected versions
All versions. Per Mojang's version manifest: up to 1.16.5 use Java 8, 1.17.x Java 16, 1.18 to 1.20.4 Java 17, 1.20.5 to 1.21.11 Java 21, and 26.1 and newer Java 25.
Frequently asked questions
Can I just install the newest Java?
For new Minecraft versions, usually yes. Old Forge versions break on new Java, so keep Java 8 available for them.
Do I need to uninstall other Java versions?
No. Several versions can be installed side by side. Point each instance to the right one.