JNI error occurred after converting jar to exe launch4j

本小妞迷上赌 提交于 2021-01-05 07:28:20

问题


I created JAR file of my JavaFX application. JAR file is working perfectly fine without any error. But when i converted jar into exe using launch4j and tried to open exe file file it gives two errors:

Java Virtual Machine Launcher Error: A JNI error has occurred, please check your installation and try again.

Java Virtual Machine Launcher A Java Exception has occurred.

Here is the log:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Main has been compiled by a more recent version of the Java Runtime (class file version 54.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(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

Can anyone help me please?


回答1:


Actually i was selecting another version of JRE in launch4j while converting to exe. Now i attached the JRE which was installed on my system while developing the application and it's working perfectly fine.




回答2:


  1. Right clicked on my project in eclipse
  2. Go to Properties
  3. Go to java compiler
  4. uncheck "Use compliance from execution environment"
  5. Select the compiler compliance level to 1.4

Now create its Jar and convert to .exe , It worked for me.



来源:https://stackoverflow.com/questions/50075705/jni-error-occurred-after-converting-jar-to-exe-launch4j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!