无法在Eclipe,NetBeans或Intellij IDEA中使用JAVA运行OpenCV-java.library.path错误 [英] Cannot run OpenCV with JAVA in Eclipe, NetBeans or Intellij IDEA - java.library.path error
问题描述
我正在运行Mint 17.1(Rebecca)KDE(64位).
I am running Mint 17.1 (Rebecca) KDE (64-bit).
我从存储库中安装了带有python绑定的opencv 2.4.8(我目前正在使用opencv-python).
I installed opencv 2.4.8, from the repository, with the python bindings (and I am currently working with opencv-python).
我无法使用IDE在Java中运行简单的示例OpenCV程序.我尝试了Eclipse,NetBeans和Intellij IDEA.
I cannot run a simple example OpenCV program in Java, using an IDE. I tried Eclipse, NetBeans and Intellij IDEA.
我将以下库添加到项目中:
I add the following library to the project:
/usr/share/OpenCV/java/opencv-248.jar
/usr/share/OpenCV/java/opencv-248.jar
When I try to run a simple example source code, I got the following error:
线程"main"中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有opencv_java248
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java248 in java.library.path
在java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
在java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
在java.lang.System.loadLibrary(System.java:1122)
at java.lang.System.loadLibrary(System.java:1122)
在Hello.main(Hello.java:7)
at Hello.main(Hello.java:7)
由于该错误,java.library.path存在一些问题.实际上,我在一些帖子(全部针对Windows用户)中看到了他们做的事情(步骤5-
From the error, there is some problem with the java.library.path. Actually, I saw in some posts (all for windows users) where they do something like (step 5 - source):
更改VM选项以添加本机库"-Djava.library.path ="C:\ opencv \ build \ java \ x86""
Change VM options to add native library "-Djava.library.path="C:\opencv\build\java\x86""
但是我不确定如何在系统中执行此步骤.例如,在Eclipse中,我添加了以下路径:/usr/lib/x86_64-linux-gnu/
But I am not sure how to implement this step in my system. For example, in Eclipse I added the following path: /usr/lib/x86_64-linux-gnu/
使用上述路径的原因是,我发现有一些opencv库:
The reason for the above path was that I found that some of the libraries of opencv are there:
$locate opencv_core
/usr/lib/x86_64-linux-gnu/libopencv_core.a
/usr/lib/x86_64-linux-gnu/libopencv_core.so
...
谢谢.
推荐答案
solition :
==>Right click on the Project
==>Properties
==>Click on RUN
==>VM Options : -Djava.library.path="C:\Your Directory where Dll is present"
==>Ok
这篇关于无法在Eclipe,NetBeans或Intellij IDEA中使用JAVA运行OpenCV-java.library.path错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!