kaklakariada / portmapper

A tool for managing port forwardings via UPnP
GNU General Public License v3.0
685 stars 89 forks source link

"A JNI error has occured" when opening the jar #60

Closed ghost closed 3 years ago

ghost commented 3 years ago

Everytime i try to open the jar, a dialog box would show up and said "A JNI error has occured, please check your installation".

kaklakariada commented 3 years ago

Usually this means your Java version is outdated. Please install Java 11 or later. If this does not help: run PortMapper from the command line using java -jar portmapper.jar and create a ticket containing the stack trace.

See https://github.com/kaklakariada/portmapper#portmapper-fails-to-start

Bluelight82 commented 3 years ago

I have the same problem with updated Java! I only have 64-bit Java though.

kaklakariada commented 3 years ago

Please run PortMapper from the command line using java -jar portmapper.jar and post the error messages.

Bluelight82 commented 3 years ago

I finally got around to extract the error message: Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/chris/portmapper/PortMapperStarter has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file 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)

kaklakariada commented 3 years ago

This error message means, that PortMapper is not compatible with the Java version installed on your machine. Please upgrade to Java 11. See https://github.com/kaklakariada/portmapper#install-java for details.

If you already have Java 11 installed, please make sure it is on the Path. You can verify this by running

$ java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode)
kaklakariada commented 3 years ago

I will close this. Please re-open if the issue still exists.

Smankusors commented 3 years ago

pardon me, but if some of us still wants to use Java 8 or Java 1.8... We can use PortMapper 2.1.1 or earlier versions, is that correct?

kaklakariada commented 3 years ago

Yes, you can use version 2.1.1 (https://github.com/kaklakariada/portmapper/releases/tag/v2.1.1) with Java 8.

Smankusors commented 3 years ago

Yes, you can use version 2.1.1 (https://github.com/kaklakariada/portmapper/releases/tag/v2.1.1) with Java 8.

thanks for the confirmation. It's possible... to add this on the readme? Java 8 end of support is still long (year 2030) 💭

kaklakariada commented 3 years ago

Thanks for the hint, I added a section about Java 1.8 to the readme.