问题
I am running Mint 17.1 (Rebecca) KDE (64-bit).
I installed opencv 2.4.8, from the repository, with the python bindings (and I am currently working with opencv-python).
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
When I try to run a simple example source code, I got the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java248 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at Hello.main(Hello.java:7)
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):
Change VM options to add native library "-Djava.library.path="C:\opencv\build\java\x86""
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/
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
...
Thank you.
回答1:
solition :
==>Right click on the Project
==>Properties
==>Click on RUN
==>VM Options : -Djava.library.path="C:\Your Directory where Dll is present"
==>Ok
来源:https://stackoverflow.com/questions/30272164/cannot-run-opencv-with-java-in-eclipe-netbeans-or-intellij-idea-java-library