# Fix "UnsupportedClassVersionError" and other Java version errors on a Minecraft server

> Which Java each Minecraft version needs, what the class version numbers in the error mean, and where the Java version is set for a server on FadeHost.

Source: https://fadehost.com/docs/java-version-errors/

`java.lang.UnsupportedClassVersionError: net/minecraft/server/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` means the server jar was built for a newer Java than the one running it. The reverse error, a jar refusing a Java that is too new, shows up as mod loading failures on old Forge versions.

## Which Java a Minecraft version needs

| Minecraft | Java |
| --- | --- |
| 1.8 to 1.16 | Java 8 (Forge 1.12 and older need exactly 8) |
| 1.17 | Java 16 |
| 1.18 to 1.20.4 | Java 17 |
| 1.20.5 to 1.21.x | Java 21 |
| 26.x | Java 25 |

Class file versions in the error map to Java releases: 52 is Java 8, 60 is 16, 61 is 17, 65 is 21, 69 is 25.

## On FadeHost the Java version follows the software

When you pick a server version in **Server Software**, the matching Java is set with it, so a Paper 1.21.8 server runs Java 21 and a Forge 1.12.2 server runs Java 8 without anything to configure. The error appears in two cases:

1. **A custom jar.** **Settings**, **General** has a **Java Version** override; its default follows the Minecraft version you picked. For a custom jar the override is used as it is, so set it to the version the jar needs, from the table above, and restart.
2. **A modpack that pins its own version.** Some packs ship a start script or a `variables.txt` asking for a specific Java. The panel follows the pack's Minecraft version, which is right in nearly every case; when a pack really wants a newer Java, use the same Java Version override. For managed software the override can never go below what the Minecraft version needs, so it cannot break a server by accident.

## Mods that fail on a newer Java

Old Forge versions (1.12.2 and earlier) do not start on Java 9 or newer, and some 1.16 mods break on Java 17. If a pack for 1.12.2 shows Java errors, the override was set to something newer: put it back to Java 8.

## Checking what runs

The first lines of the console after a start print the Java version, for example `Starting org.bukkit.craftbukkit.Main` followed by `java version "21.0.x"`. Compare it with the table before changing anything else.
