将jar转换为exe launch4j后发生JNI错误 [英] JNI error occurred after converting jar to exe launch4j
问题描述
我创建了JavaFX应用程序的JAR文件. JAR文件运行正常,没有任何错误.但是,当我使用launch4j将jar转换为exe并尝试打开exe文件时,出现了两个错误:
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虚拟机启动器 错误:发生了JNI错误,请检查您的安装并重试.
Java Virtual Machine Launcher Error: A JNI error has occurred, please check your installation and try again.
Java虚拟机启动器 发生了Java异常.
Java Virtual Machine Launcher A Java Exception has occurred.
这是日志:
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)
有人可以帮我吗?
推荐答案
实际上,我在转换为exe时在launch4j中选择了另一个JRE版本.现在,我在开发应用程序时附加了已安装在系统上的JRE,它运行正常.
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.
这篇关于将jar转换为exe launch4j后发生JNI错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!