“发生了JNI错误”对于该程序的一个实例,而不是另一个实例 [英] "A JNI Error has occurred" for one instance of the program, not for another

查看:173
本文介绍了“发生了JNI错误”对于该程序的一个实例,而不是另一个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一台运行良好的计算机上在Eclipse Java Mars中创建了一个大型程序。我将程序导出为可运行的Jar文件并运行它没有任何问题。即使我将整个项目导出到另一台计算机,该程序仍然有效。

I made a large program in Eclipse Java Mars on one computer which worked fine. I exported the program as a runable Jar-file and running it gave no problem whatsoever. Even when I exported the entire project to another computer, the program still works.

当我对项目进行细微更改时,问题出现在另一台计算机上。这些更改只是基于内容的更改,并且应该对程序的功能没有任何影响。 从eclipse运行程序似乎没有问题。但是,当我想运行新创建的Jar文件时,我收到以下错误:

The issue came forth on the other computer when I made minor changes to the project. These changes were only content based changes and should make no difference on the functionality of the program. Running the program from eclipse appears to have no problems. However, when I want to run the newly created Jar-file I get the following error:

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

后跟一个框架说:

A Java Exception has occurred. 

所以我的问题是:

同一程序的不同实例怎么可能无法通过Jar文件运行,而较旧的实例可以?

我使用了在两台计算机上都使用相同的JDK版本(1.8.0_73),并以几乎相同的方式安装它们:我首先通过组合版本将NetBeans与NetBeans一起安装。接下来,我安装了Eclipse。唯一的区别是在新计算机上我安装了离线eclipse,即没有Eclipse安装程序

I used the same JDK version (1.8.0_73) on both computers, and installed them in pretty much the same way: I first installed Java together with NetBeans via a combined release. Following, I installed Eclipse. The only difference is that on the new computer I installed eclipse offline, i.e. without the Eclipse installer

推荐答案

Eclipse提供了不同的导出方式JAR的项目。要在运行导出的JAR时使本机库(或库)可用,请选择在生成的JAR中打包所需的库选项。

Eclipse presents different ways to export JAR for a project. To have the native library (or libraries) available when running the exported JAR, choose "package required libraries in generated JAR" option.

这篇关于“发生了JNI错误”对于该程序的一个实例,而不是另一个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆