
Your server stopped after an update with a line about class file versions, or you want the right Java in place before you update. Mojang publishes a version file for every release that names its Java, and this guide turns those files into what you install for vanilla, Paper, Fabric, Forge, NeoForge and modpacks such as ATM10, with the install commands, the Java 25 builds side by side and the errors a wrong Java prints.
Quick answer: Minecraft 1.20.5 and every release up to 1.21.11 require Java 21; the change came with snapshot 24w14a in April 2024. Minecraft 26.1 and newer, including 26.2, 26.3 and the 26.4 snapshots, require Java 25. Versions 1.18 to 1.20.4 need Java 17, 1.17 and 1.17.1 were built for Java 16, and 1.16.5 and older run on Java 8. The best Java 25 by brand is any 64-bit OpenJDK 25 build you keep updated: Amazon Corretto, the one Paper's guide installs, has free updates planned until July 2032, while Oracle's free updates for JDK 25 stop in September 2028. Check your server with java -version, and on a Pterodactyl panel switch the Java version in the Startup tab before you update.
Which Java Each Minecraft Version Needs
Every release has a version file on Mojang's servers with a javaVersion field, which the launcher uses to pick its Java. The middle column comes from those files, checked on 31 October 2026 for every release from 1.8 to 26.3. The right column is what to install on a server.
| Minecraft version | Java in Mojang's version file | Java to run the server on |
|---|---|---|
| 1.8 to 1.16.5 | Java 8 | Java 8 |
| 1.17 and 1.17.1 | Java 16 | Java 17 |
| 1.18 to 1.20.4 | Java 17 | Java 17 |
| 1.20.5 to 1.21.11 | Java 21 | Java 21 |
| 26.1 to 26.3 | Java 25 | Java 25 |
Paper's download API lists the same minimum Java as the middle column for every Paper build from 1.8.8 to 26.3.
Minecraft 1.8 to 1.16.5
Use Java 8. Some setups run on Java 11 (the All The Mods team lists 8 or 11 for 1.16), but Java 8 stays the safe baseline for a legacy network.
Minecraft 1.17 to 1.20.4
Use Java 17. Mojang names Java 16 for 1.17 and 1.17.1, but Java 16 was a short-term release that Java 17 replaced, and a Java 17 runtime loads Java 16 class files, so one install covers the whole range. Whether Java 21 is worth it on these versions is covered in Java 21 vs Java 17.
Minecraft 1.20.5 to 1.21.11
Use Java 21 for all 14 releases in this range. 1.21.11 was the last 1.x version; the next release was 26.1.
Minecraft 26.1 and Newer
Use Java 25. Every 26.x entry in Mojang's version list names it, from 26.1 Snapshot 1 up to 26.4-snapshot-7 of 3 November 2026.
Minecraft 1.20.5 Requires Java 21 (Snapshot 24w14a and Newer)
The move to Java 21 is official. Under Technical Changes, Mojang's 1.20.5 changelog of 23 April 2024 says "The game now requires Java 21", "The game now requires a 64-bit Operating System" and "The included Java distribution is now the Microsoft build of OpenJDK 21.0.3".
The same lines first appeared in snapshot 24w14a on 3 April 2024: 24w14a and every version after it require Java 21, while 24w13a still named Java 17. So 1.20.5, 1.20.6 and every 1.21 release up to 1.21.11 need Java 21 on the server.
Inside the server jar, the class file format changed. net/minecraft/bundler/Main.class, the class the server jar starts with, is version 61 (Java 17) in the 1.20.4 jar and version 65 (Java 21) in the 1.20.5 to 1.21.11 jars we checked. Start one of the newer jars on Java 17 and the JVM stops before Minecraft prints a line:
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
A modded server fails on Java 17 too, with a message that depends on the loader. Install Java 21, and check that java -version reports a 64-bit VM, since the game needs a 64-bit system from 1.20.5 on.
Java 25 for Minecraft 26.1 and Newer
Mojang moved to Java 25 with 26.1 Snapshot 1 on 16 December 2025 ("The game now requires Java 25"), and the 26.1 release notes of 24 March 2026 repeat it, with the Microsoft build of OpenJDK 25 as the launcher's Java. The 26.3 version file names Java 25, and the 26.3 server jar is built as class file version 69, the Java 25 format.
Java 25, out since 16 September 2025, is a long-term support (LTS) release; Oracle lists 8, 11, 17, 21 and 25 as LTS, so Minecraft went from one LTS to the next.
A 26.x server on Java 21 stops at once, with a message that depends on the software:
- Vanilla: the same
UnsupportedClassVersionErroras above, with class file version 69.0 and "up to 65.0". - Paper: "Minecraft 26.1 and newer requires running the server with Java 25 or above."
- Forge:
java.lang.IllegalStateException: Current Java is 21 but we require at least 25. Forge's launcher reads the Java it wants from the installer: 25 in the Forge 26.3 installer, 21 in the one for 1.21.11. - NeoForge and Fabric: both moved to Java 25 with 26.1. NeoForge's 26.1 post says "Minecraft is now using Java 25", and Fabric's 26.1 post sets Java 25 as the minimum for building 26.1 mods.
Java 21 or Java 25?
The Minecraft version decides, not speed or features. 1.20.5 to 1.21.11 run on Java 21, modpacks on 1.21.1 such as ATM10 included, and 26.1 and newer on Java 25. A Java 25 runtime can load Java 21 class files, so a 1.21.1 server may start on it, but its mods and start scripts are built and tested for Java 21. Switch to Java 25 together with the move to 26.x.
Which Java 25 Build Is Best for a Minecraft Server?
Any 64-bit OpenJDK 25 build runs a 26.x server, so the best Java 25 by brand is the one you keep updated. Paper's Java guide installs Amazon Corretto and names Eclipse Adoptium (Temurin), Microsoft and Azul Zulu as alternatives; it calls Oracle's JDK functionally identical but does not recommend it, because of its installer and earlier licensing. From the vendors' own pages on 3 November 2026:
| Java 25 build | Licence | Updates for Java 25 | Ubuntu or Debian package |
|---|---|---|---|
| Amazon Corretto | GPLv2 with Classpath Exception, free | Last planned update July 2032, end of life October 2032 | java-25-amazon-corretto-jdk |
| Eclipse Temurin | GPLv2 with Classpath Exception, free | At least until September 2031 | temurin-25-jdk |
| Microsoft Build of OpenJDK | GPLv2 with Classpath Exception, free | At least until September 2030 | msopenjdk-25 (Ubuntu 18.04 to 24.04, Debian 11 and 12) |
| Azul Zulu | Free and open source, no support obligation | Commercial Azul Core support until September 2033 | zulu25-jdk |
| Oracle JDK | Oracle No-Fee Terms and Conditions, free in production | Free until September 2028, then under the OTN licence, which needs a fee for production use beyond its free grants | jdk-25_linux-x64_bin.deb from oracle.com |
How to pick:
- No preference: Corretto, the build Paper's guide installs, with updates planned until July 2032.
- Adoptium already set up for Java 17 or 21: Temurin from the same repository, which also serves Debian 12.
- Same build as the Minecraft Launcher: Microsoft, though its repository has no Debian 13 package.
- Skip Oracle JDK on a server you will run past September 2028, when its free updates end.
From a vendor's apt repository, updates arrive with your normal sudo apt update and sudo apt upgrade. Corretto, as in Paper's guide:
sudo apt-get update
sudo apt-get install ca-certificates apt-transport-https gnupg wget
wget -O- https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | sudo tee /etc/apt/sources.list.d/corretto.list
sudo apt-get update
sudo apt-get install -y java-25-amazon-corretto-jdk libxi6 libxtst6 libxrender1
Microsoft on Ubuntu (on Debian 11 or 12, run sudo apt install wget lsb-release -y first and use debian instead of ubuntu in the URL):
wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install msopenjdk-25
Azul Zulu:
sudo apt install -y gnupg ca-certificates curl
curl -s https://repos.azul.com/azul-repo.key | sudo gpg --dearmor -o /usr/share/keyrings/azul.gpg
sudo chmod 644 /usr/share/keyrings/azul.gpg
echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | sudo tee /etc/apt/sources.list.d/zulu.list
sudo apt update
sudo apt install zulu25-jdk
Temurin and the openjdk-25-jdk package from Ubuntu or Debian itself are in the install section below. With another Java already installed, set the default as shown under Several Java Versions on One Machine.
Mod Loaders and Modpacks
Fabric, Forge and NeoForge
All three follow the Minecraft version you run: Java 17 on 1.18 to 1.20.4, Java 21 on 1.20.5 to 1.21.11 and Java 25 on 26.1 and newer. Forge checks before anything loads and stops with the "Current Java is ... but we require at least ..." message above. Also read each mod's minimum Java note on Modrinth or CurseForge.
All The Mods 10 (ATM10) and Java 21
ATM10 runs on Minecraft 1.21.1 with NeoForge, so the Java version All The Mods 10 requires is Java 21, and the All The Mods team's guide lists Java 21 for 1.21 and newer. The pack's start script checks first. In the ServerFiles-8.3 zip of 15 October 2026, startserver.sh stops with one of these lines when Java is older than 21 or missing:
Minecraft 1.21 requires Java 21 - found Java 17
Minecraft 1.21 requires Java 21 - Java not found
The same script reads an ATM10_JAVA variable with the full path of the Java to use. Our ATM10 Java guide covers the pack in more detail.
How to Check and Install the Right Java
Check What Your Server Runs
java -version
The first line shows the version and the last line should mention a 64-Bit VM. Paper's guide shows this output for Java 25:
openjdk version "25" 2025-09-16
OpenJDK Runtime Environment (build 25+36-3489)
OpenJDK 64-Bit Server VM (build 25+36-3489, mixed mode, sharing)
java -version only tells you about the java on your PATH. If your start script calls Java by its full path, check that one.
Ubuntu and Debian
Ubuntu 22.04 and 24.04 and Debian 13 package both versions:
sudo apt update
sudo apt install openjdk-25-jdk
Use openjdk-21-jdk instead for a 1.20.5 to 1.21.11 server. Paper's guide warns against the headless packages, which miss libraries Paper needs, so install the full JDK.
Debian 12 only packages Java 17, not 21 or 25. There, or wherever apt cannot find the package, add the Eclipse Adoptium repository with Adoptium's own steps and install Temurin:
sudo apt install -y wget apt-transport-https gpg
wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update
sudo apt install temurin-25-jdk
Swap in temurin-21-jdk for 1.20.5 to 1.21.11 or temurin-17-jdk for 1.17 to 1.20.4.
Several Java Versions on One Machine
Each Java gets its own folder under /usr/lib/jvm. To change the default java, run:
sudo update-alternatives --config java
Or call the right Java by its full path in each server's start script, so a 1.21.11 and a 26.3 server can share one machine:
/usr/lib/jvm/java-25-openjdk-amd64/bin/java -Xms4G -Xmx4G -jar server.jar nogui
That is the path of the Debian and Ubuntu OpenJDK 25 package on a 64-bit Intel or AMD machine; ls /usr/lib/jvm shows the folders on yours. On Windows, install a 64-bit JDK from Adoptium, Microsoft or Amazon, open a new terminal, and point your start.bat at the full path of the java.exe you want, since with several versions the order in PATH decides which one runs.
On a Hosting Panel
Pterodactyl runs each server in a Docker container whose image holds one Java version, and you pick that image in the server's Startup tab under Docker Image. Paper's guide adds that Pterodactyl offers the switch by itself when a Paper server starts on the wrong Java, and that a missing Java 25 entry means an administrator has to update the egg. On a Space-Node Minecraft server you set the Java version in the Startup tab yourself, no ticket needed; if Java 25 is not in the list for your server, ask us in live chat before you update.
Errors a Wrong Java Version Prints
"has been compiled by a more recent version of the Java Runtime"
This UnsupportedClassVersionError means your Java is older than the server jar or a mod. The class file version in the message tells you which Java it wants:
| Class file version in the error | Java it needs |
|---|---|
| 52.0 | Java 8 |
| 60.0 | Java 16 |
| 61.0 | Java 17 |
| 65.0 | Java 21 |
| 69.0 | Java 25 |
The number after "up to" is the Java you have now. Install the one the first number points to.
"Unsupported class file major version"
This message comes from ASM, a bytecode library in mod loaders and build tools, when it meets a class file newer than it can read (ASM 9.11 and later say "Unsupported class file version"). Java is fine here: the loader is older than the Java it runs on, or than a mod. Run the Java from the table for your Minecraft version, with mods built for that version.
Errors That Are Not About Java
"Could not find or load main class" usually means a broken start script, the wrong folder or a damaged jar. Before reinstalling, check that java -version fits your Minecraft line and that no jars from another version are mixed in.
Client Versus Server Java
Players do not install Java for the game: the launcher downloads the runtime the version file names, which for 26.x is Java 25 (25.0.1 in Mojang's runtime list). Your server runs on whatever Java the machine or container has, so a client that starts fine says nothing about the server.
Upgrade Checklist for a Java Change
- Back up worlds and plugin or mod data.
- Test on a copy of the server.
- Update the server software, plugins and mods for the target Minecraft version.
- Switch Java and test login, world load and busy areas such as farms.
- Move the live server in a quiet hour, with the backup at hand.
Review your JVM flags after the switch too: start from Aikar's flags, and our ZGC vs G1GC guide has flag sets for Java 21 and Java 25. Coming from 1.21.x, the 26.3 server update guide covers the rest of the move.
FAQ
Does Minecraft 1.20.5 really require Java 21?
Yes. Mojang's 1.20.5 changelog says "The game now requires Java 21", a requirement that started with snapshot 24w14a. Every release from 1.20.5 to 1.21.11 names Java 21 in its version file, and on Java 17 the server stops with an UnsupportedClassVersionError about class file version 65.0.
Can I run Java 17 for a 1.21 server? No. The 1.21 to 1.21.11 jars are Java 21 class files, Paper lists Java 21 as the minimum for its 1.21 builds, and the ATM10 start script refuses anything older than 21. If you are moving to 26.x anyway, go straight to Java 25.
What Java version do Minecraft 26.2 and 26.3 need? Java 25, the same as 26.1. Mojang's version files for 26.1, 26.1.1, 26.1.2, 26.2 and 26.3 all name Java 25, Paper lists Java 25 as the minimum for its 26.x builds, and the 26.4 snapshots name Java 25 too.
Can I run a 1.21.1 server on Java 25? It may start, because Java 25 can load older class files, but Mojang names Java 21 for 1.21.1 and modpacks on 1.21.1 such as ATM10 are built for Java 21. Keep 1.21.x servers on Java 21 and switch to Java 25 when you update to 26.x.
What's the best Java 25 (by brand) for Minecraft? Any 64-bit OpenJDK 25 build you keep updated. Amazon Corretto, the build Paper's guide installs, has free updates planned until July 2032 and Eclipse Temurin until at least September 2031, while Oracle's free updates for JDK 25 end in September 2028. Skip the headless packages for Paper.
Sources
All opened on 3 November 2026:
- Mojang: the version manifest and the version files it links for every release from 1.8 to 26.3 and every 26.x entry, among them 1.20.4, 24w13a, 24w14a, 1.20.5, 1.21.11, 26.1 Snapshot 1, 26.1, 26.3 and 26.4 Snapshot 7; the Java runtime list; the server jars of 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1, 1.21.4, 1.21.10, 1.21.11, 26.1, 26.2 and 26.3 (manifest and the class file version of net/minecraft/bundler/Main.class), for example 1.20.4, 1.20.5, 1.21.11 and 26.3
- Minecraft.net: Minecraft Snapshot 24w14a, Minecraft Java Edition 1.20.5, Minecraft 26.1 Snapshot 1, Minecraft Java Edition 26.1, Java Edition server download
- PaperMC: Installing or updating Java; the download API entry of every Paper version, for example 1.17.1, 1.20.4, 1.20.5, 1.21.11 and 26.3; the Paperclip Java check
- MinecraftForge: the bootstrap shim; promotions; the installers for 26.3-66.1.2 and 1.21.11-61.2.4 (bootstrap-shim.properties)
- NeoForged: NeoForge for Minecraft 26.1
- Fabric: Fabric for Minecraft 26.1
- All The Mods: Java guide; the CurseForge record of ATM10 ServerFiles-8.3.zip (startserver.sh read from the zip)
- OpenJDK: JDK 25; JDK 17 source of the class version error and the launcher message
- Oracle: Java SE Support Roadmap; Java downloads (JDK 25 under the NFTC); JDK 25 installation on Linux; Java Virtual Machine Specification, chapter 4, Java SE 21 (Table 4.1-A) and Java SE 25 (section 4.1)
- OW2 ASM: ClassReader.java in ASM 9.10 and ASM 9.11
- Eclipse Adoptium: Linux installation, support roadmap, FAQ (licence), Debian 12 package index
- Amazon: Corretto FAQs (licence and support calendar), installing Corretto 25 on Debian-based Linux, Corretto apt package index
- Microsoft: Microsoft Build of OpenJDK support roadmap, install guide, FAQ (licence), package indexes for Ubuntu 24.04 and Debian 13
- Azul: support roadmap, installing Azul Zulu on Debian and Ubuntu, Azul Core, OpenJDK terms of use, Zulu apt package index
- Ubuntu packages: openjdk-25-jdk in 24.04 and 22.04, openjdk-21-jdk in 24.04 and 22.04
- Debian packages: openjdk-25-jdk and openjdk-21-jdk in Debian 13, openjdk-17-jdk in Debian 12, the openjdk-25-jre-headless file lists of Debian 13 and Ubuntu 24.04; update-alternatives(1)