UnsatisfiedLinkError Java OpenCV和可执行jar Eclipse

时间:2014-05-29 20:06:14

标签: java eclipse jar executable

抱歉,我没有解决问题的方法。你能救我吗?

我在Eclipse上有一个应用程序,它可以正常使用openCV,但是如果将它导出到jar可执行jar中,我在启动jar时会出现命令提示符错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path

    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at grafic.WindowInterface.windowsValidate(WindowInterface.java:695)
    at grafic.WindowInterface.validate(WindowInterface.java:677)
    at grafic.WindowInterface$4.widgetSelected(WindowInterface.java:388)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
    at grafic.WindowInterface.open(WindowInterface.java:122)
    at grafic.WindowInterface$1.run(WindowInterface.java:105)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at grafic.WindowInterface.main(WindowInterface.java:101)
  • 我已经从this tutorial.

  • 安装了开放式简历(2.4.9)
  • 我在Windows sistem路径中添加了这个变量:

    C:\ Program Files \ Java \ opencv \ build \ x86 \ vc10 \ bin;

  • 我已经创建了可执行jar as in this tutorial.

你有什么建议吗?为什么应用程序在eclipse上正常工作而不能在可执行jar中工作?

感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

抱歉,我没有解决方案。

我必须将openCV.jar库打包成可执行的java项目.jar。

答案 1 :(得分:0)

我遇到了同样的问题。

之所以发生这种情况,是因为我在本地图书馆位置上遇到了错误。配置:

转到Eclipse - >窗口 - >首选项:

Goto Eclipse -> Window -> Preferences

转到用户库:

enter image description here

确保您的本机库位置路径是(将c:/opencv-2.4.9更改为您自己的opencv文件夹):

C:/opencv-2.4.9/build/java/x64

而不是:

C:/opencv-2.4.9/build/x64

(我错过了 / java 文件夹...)