简体   繁体   English

无法运行我的java .exe程序。 我该如何解决? (“发生Java异常”)和JNI问题

[英]Can't run my java .exe program. How do I troubleshoot this ? (“A Java exception has occured”) and JNI problem

My problem is that I created a Java app that I exported to .jar if I open it in .jar it works perfectly but I'd like to make it an .exe app so I've tried launch4j but if I try to use the .exe file created I get "Error, A JNI error has occured, please check your installation etc..." and "A Java Exception has occured" also I don't know if it's useful but if I try to test the wrapper in Launch4j I get the same messages and this on the log : 我的问题是,如果我在.jar中打开它,则我创建了一个导出到.jar的Java应用程序,它可以正常运行,但是我想将其设为.exe应用程序,因此我尝试了launch4j,但是如果尝试使用创建的.exe文件,我收到“错误,发生了JNI错误,请检查安装等...”和“发生Java异常”,我也不知道它是否有用,但是如果我尝试在其中测试包装器Launch4j我在日志中收到相同的消息,并且此消息:

Executing:C:\Users\edena\Documents\CGen.exe
Exception in thread "main" java.lang.UnsupportedClassVersionError: CodeGenerator 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)

I've already tried to see if the problem was from my Java version but it says it's the latest. 我已经尝试查看问题是否出在我的Java版本中,但是它说这是最新的。 Also, I tried deleting metadata in Eclipse and doing the process again but it didn't work 另外,我尝试在Eclipse中删除元数据并再次执行该过程,但是它不起作用

You're trying to execute a class that was compiled with a JDK 11 with a JRE 8. 您正在尝试执行使用JDK 11和JRE 8编译的类。

You can either specify the target version 8 when you compile your classes, or set the min version in your launch4j configuration: 您可以在编译类时指定目标版本8,也可以在launch4j配置中设置最低版本:

  <jre>
    ...
    <minVersion>11</minVersion>
    ...
  </jre>

(Posted on behalf of the question author) . (代表问题作者发布)

I found out how to make it work. 我发现了如何使其工作。 I went in my IDE (Eclipse) and right clicked on my project then Properties>Java Compiler then de-checked "Use compliance from execution environment 'JAVA SE-11' on the 'Java BuildPath>I then set the compiler compliance level on 1.4. 我进入我的IDE(Eclipse),然后右键单击我的项目,然后单击属性> Java编译器,然后取消选中“使用Java BuildPath上的执行环境'JAVA SE-11'的合规性>我然后将编译器合规性级别设置为1.4 。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java 程序。 需要简化 public boolean equals (object B){ is to long。 我不知道如何减少程序那部分的编码 - Java Program. Need to simplified public boolean equals (object B){ is to long. I do not how to reduce the coding in that part of my program Java程序。 如何在数组中循环“ isLucky”方法?如何在main方法中打印结果? - Java program. How do I loop my "isLucky method through the array? and how do I print the result in the main method? 无法弄清楚如何在Java博士中为我的Java程序进行try Catch异常? - Can't Figure Out How To Do a Try Catch Exception for my Java Program in Dr. Java? 如何将我的 Java 程序转换为 .exe 文件? - How can I convert my Java program to an .exe file? Intellij Java:发生Jni错误 - Intellij Java: Jni error has occured Java程序。 如何通过我的数组循环我的“isLucky”方法? 另外,如何在 main 方法中正确打印我的结果? - Java program. How do I loop my "isLucky" method through my array? Also, how do I print my results correctly in the main method? 如何运行已粘贴到我的程序中的 java 代码 - How can I run java code that has been pasted into my program 发生异常后运行清理代码(Java/Cucumber) - Run cleanup code after exception has occured (Java/Cucumber) 我们如何使用Java程序将手机连接到PC? - How can we connect a mobile to a pc using a Java program.? 如何修复在包中移动我的java文件后出现的错误“java.lang.NoClassDefFoundError”? - How can I fix the error “java.lang.NoClassDefFoundError” that has occured after moving my java files in packages?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM