简体   繁体   English

发生了JNI错误

[英]A JNI error has occured

I built a GUI form through Intellij. 我通过Intellij构建了一个GUI表单。 I exported the app as an artifact to a JAR file. 我将应用程序作为工件导出到JAR文件。 I opened the JAR on my personal computer and had no issues - the app appeared and fully functioned. 我在个人计算机上打开了JAR,没有任何问题-该应用程序出现并且功能正常。 I tried running it on someone else's computer, and when I clicked on the JAR file it said "Error: A JNI error has occurred, please check your installation and try again." 我尝试在其他人的计算机上运行它,当我单击JAR文件时,它显示“错误:发生了JNI错误,请检查您的安装,然后重试。” After that box, it said "A Java Exception has occurred." 在该框之后,它说“发生了Java异常”。 I tried this on my laptop, and the JAR file properly opened. 我在笔记本电脑上尝试了此操作,然后正确打开了JAR文件。

I think it has to do with the JRE or JDK being necessary on a computer, but I do not know enough about Java to fix my problem. 我认为这与计算机上必需的JRE或JDK有关,但是我对Java的了解不足以解决问题。 The computers I tried that it didn't work on either had JDK installed or not installed at all. 我尝试无法正常运行的计算机已经安装了JDK,或者根本没有安装。

Suggestions? 有什么建议吗?

Edit - I'm using Java 10. The other computer that it didn't work on had Java 8. I ran jar on the command, and the error is here - stack trace I guess the solution is update java? 编辑-我使用的是Java10。另一台无法使用的计算机上安装了Java8。我在该命令上运行了jar,错误在这里- 堆栈跟踪我猜解决方案是更新Java? but then is there a way to force java 10 code to run on a java 8 computer? 但是有没有办法强制Java 10代码在Java 8计算机上运行?

I figured it out. 我想到了。 I had to change the compiler on my app, and then, rebuild the artifact. 我必须在应用程序上更改编译器,然后重新构建工件。

Change compiler: File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler 更改编译器:文件->设置->构建,执行,部署->编译器-> Java编译器

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM