mojira.dev
MC-225505

A JNI error has occurred, please check your installation and try again

Mod Notice

Error messages:

A JNI error has occurred, please check your installation and try again
A Java exception has occurred.

A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0

This error happens when you launch the client (the game) or server (the .jar) without Java 16 in 21w19 and above. Minecraft has was updated to use Java 16 as per the 21w19a changelog:

Minecraft now uses a more recent version of Java. If you are using a default setup the Launcher will download and install the correct version. If you are using a custom Java setup or a third-party launcher, you will need to ensure that your Java installation is version 16 or above.

To fix this issue, download the AdoptOpenJDK and follow the steps below for the client or server.

Client: Make sure that your launcher is running Java 16. To do so, change the Java executable runtime to target "javaw.exe" in C:\Program Files\Java\jdk-16.0.1\bin\javaw.exe or where you installed Java 16. Contact your launcher maintainers if you cannot switch or do not know how to switch to Java 16.

Server: If you are running a server on your computer, make sure that AdoptOpenJDK is running the .jar. To make sure on Windows 10, the file properties should look like this:

[media]

Try uninstalling Java 8 and restart your computer to make sure you are running Java 16. If you are running a server with a host, contact the host.

If none if this works, please contact Community Support.

When I open Minecraft it throws me the error: "A JNI error has occurred, please check your installation and try again" and "A Java exception ocurred", I really don't know, I have the latest version of Java and opengl 3.1. Please help me.

Linked issues

Attachments

Comments

Danel Animations

I don’t know, but you can reinstall Java and the launcher, but Mojang does not touch here

Asteraoth

Are you running the official launcher? If not, is your launcher using Java 16?

Asteraoth

@unknown You are probably not using the official launcher. If that is the case, please read the mod notice.

SirDaddicus

I did not see this at 21W17A, but I see it now on 21W20A. I ONLY see it on server, not singleplayer, which I've been playing every day through 17, 18, 19, and 20. So, I think this is a server-only bug. Others should chime in if this is not true.

Also, both Mojang and other sources have indicated that Minecraft is using Jave version 16, which doesn't even exist. Java is at version 8.291 currently.

SirDaddicus

I am using the official launcher, and there's never been a Java development kit installed on this computer. So, the proposed "fix" does not apply.

leo60228

You have always needed Java to be installed to run Minecraft. Previous versions of Minecraft have required a minimum of Java 8, while 21w19a requires a minimum of Java 16. Whether you're using a Java Development Kit or not is irrelevant to this issue.

The launcher confusion stems from the fact that the official launcher will automatically install the required Java version. If you're playing 21w19a or a newer version through the official launcher, you are using Java 16, as can easily be seen by checking the F3 debug screen.

None of this is different between the client and server. However, the server will not automatically install Java like the launcher will, so if you've been using an older version of Java you'll need to manually update.

The latest version of Java is Java 16.0.1, not 8.0.291. While both versions have received security fixes since the initial release, Java 16 was released in March 2021 while Java 8 was released in March 2014.

Unlike Java 8, there's no single provider of downloads for Java 16. Some major ones are:

I would personally recommend AdoptOpenJDK, but the choice here is up to you.

Robert Pimentel

I agree completely.

Alexander Kevin

The wording java 16 is a little bit confusing here.

Java contains 2 things, Java Runtime Environment (JRE) and Java Development Kit (JDK). 

What's causing confusion here is the latest version of JRE is 8, meanwhile the latest version for JDK is 16

What you need is JDK 16. Since Java 16 don't have JRE, you need to specifically download JDK 16. Even if you don't develop java apps.

 

Matus Uhlar

perhaps MCL could have list of minecraft versions and minimum-maximum versions of java supported
minecraft 1.12 to 1.16.5 require at least JRE 1.8, but they do work with newer versions e.g. jre 1.11
minecraft below 1.6 don't support JRE 1.8 (iirc)

CM

Not trying to be obnoxious by triggering this to reopen, but as all of the similar cases link to this one I decided to ask here (not sure how else to ask.) Out of curiosity, why did Mojang decide to build based on a short-term Java release instead of an LTS version? Most companies I work with professionally try to link their stuff to LTS versions for maximum compatibility/minimum pain for end-users. Microsoft itself is stating that they only support LTS versions for their version of openJDK for that same reason, re: https://github.com/microsoft/openjdk/discussions/17 . For me as an end-user running a private Minecraft server so that my son and I can play, it means that I have to manually maintain my server using a manual installation of Java 16, instead of being able to use the Debian-maintained version, which is less than ideal.

ArsenHere

So I updated my java to 16.02 but it still doesn't work. Can someone help?

Daniel Andrés De La Hoz Coha

(Unassigned)

Community Consensus

(Unassigned)

21w19a

Retrieved