mojira.dev
MC-225946

Error: A JNI error has occurred

This is possibly a duplicate of 225505 (but on Minecraft Server). However, that ticket was resolved in error. Please do NOT resolve this ticket as a duplicate unless 225505 is reopened.

I haven't run my server since 21W17A, so the development note that Java (SDK) 16 is now required probably applies. However, it has absolutely nothing to do with the launcher, since the launcher isn't even running at the time of the error. The error comes when I try to bring up my server with

java -Xmx2G -Xms2G -jar server.jar nogui

This has worked for months. Now it immediately generates the error "Error: A JNI error has occurred" (full text below).

Singleplayer running any of the snapshots and datapacks between 17 and 20 has worked. I've been playing singleplayer throughout this period, and it still works.

 

NOTE on 225505: the submitter specified the correct version of the JDK in the ticket, despite the Mod Note. That's why I say it was resolved in error. However, my ticket might be legitimately a separate ticket, as that one doesn't state whether s/he's running server or singleplayer. Certainly the note about the launcher being a culprit is unrelated to my ticket.

 

If it is determined that the server code I'm running needs to be updated (to include SDK 16), then please include information as to how to do that as part of the resolution. Copying the old development note that does not include that information is not sufficient.

 

Full text of the error message:

Error: 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 fi
le versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

Comments 8

the submitter specified the correct version of the JDK in the ticket, despite the Mod Note. That's why I say it was resolved in error.

I saw that. However, they have both Java 8 and 16 and their launcher is probably not the official one.

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

If it is determined that the server code I'm running needs to be updated (to include SDK 16), then please include information as to how to do that as part of the resolution.

MC-225505:

Server: If you are running a server on your computer, make sure to download the Java SE Development Kit 16. If you are running a server with a host, contact the host to use Java 16.

As the error says ("has been compiled by a more

recent version of the Java Runtime"), this error is because Java is launching with the wrong version.

I DO NOT HAVE THE JDK (any version) on my computer! And I am NOT running a server with a host.

IF there is any part of JDK on my computer, it came as part of Minecraft Server. So, HOW do I get the correct one?

On MC-225505, "Java SE Development Kit 16" is a hyperlink to https://www.oracle.com/java/technologies/javase-jdk16-downloads.html. You download it there.

Why did I never have to install that before?

More importantly, is it part of the MC server installation? If so, how do I update the server installation. I REALLY do not want to have to install Java's full SDK just to run this game.

I got that error when I didn't have the JDK installed. I simply installed it and the error was gone (because Java 8 291 was trying to run it). You never needed Java 16 because the minimum Java version was 8 before 21w19a.

This is going to have to change before C&C releases. You can't ask end-users to install a development kit. Development kits are for developers, not users. It is development's responsibility to include those run-time pieces needed to match their code.

I'll give it a try, and you may be right. But, the solution needs to be changed in the code. No self-respecting development organization should EVER require a DK for end users.

That worked. I still maintain that this is not a valid long-term arrangement.

You are a special person..

SirDaddicus

(Unassigned)

Unconfirmed

(Unassigned)

21w20a

Retrieved