Fixing Java Version Mismatches
Aug 11, 2026
Which Java version does your server need?
Every Minecraft version requires a specific minimum Java version. Using the wrong one produces an error like "A JNI error has occurred" or "class file has wrong version." Here is the quick reference:
- Minecraft 1.18 and newer: Java 17 or later
- Minecraft 1.21 and newer: Java 21 or later
- Minecraft 1.17: Java 16
- Minecraft 1.12 to 1.16.5: Java 8
Forge and NeoForge servers sometimes have their own Java requirements on top of this. Check your loader's documentation if the above does not fix it. For servers created in Coalstack this rarely comes up, because it picks the matching Java version itself; a mismatch mostly happens with servers started outside Coalstack, or if the automatic Java download failed and it fell back to the Java on your PATH.
Checking what Java you have installed
Open a Command Prompt and run java -version. The first line of output tells you the version. It will look something like openjdk version "21.0.5" or java version "1.8.0_401".
You do not need this for servers you create in Coalstack: it picks the Java version each server needs, downloads it from Adoptium the first time, and keeps it in its own folder. The command above is for servers you run yourself outside Coalstack, and for the fallback case - if the automatic download fails, Coalstack uses whatever java is on your PATH.
Installing the right Java version
The safest option is to install the latest Java 21 (LTS) from Adoptium. It covers every Minecraft version from 1.18 onward, which is most servers running today. Download the .msi installer for Windows, run it, and accept the defaults. Coalstack will detect it on the next launch.
If you are running an older server on Java 8, install that alongside Java 21. Both can coexist. Servers managed by Coalstack need nothing from you here: an older Minecraft version gets its own Java 8 and a newer one gets Java 21, side by side.
If you installed Java yourself for a server outside Coalstack, restart that server afterwards so it picks up the new version.

