Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am trying to set up Eclipse (Neon version) with OpenCV 3.0.0 and I ran into an issue.
When I am loading an image, the code below:
Mat m = Imgcodecs.imread("newimage.jpg");
the following error is thrown:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_1(Ljava/lang/String;)J
at org.opencv.imgcodecs.Imgcodecs.imread_1(Native Method)
at org.opencv.imgcodecs.Imgcodecs.imread(Imgcodecs.java:82)
at TestOpenCVFeats.main(TestOpenCVFeats.java:39)
Everything is set up according to this site
Set up OpenCV for Java in Eclipse
Also added the path to java.library.path with:
export LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/usr/local/share/OpenCV/java
confirmed it is there with:
java -XshowSettings:properties
and to the $PATH variable.
Also added this command to JVM run configuration:
-Djava.library.path= "/usr/local/share/OpenCV/java"
Also tried with this line of code and without it:
System.loadLibrary("libopencv_java300");
The permissions for the files on the path /usr/local/share/OpenCV/java are:
-rwxr-xr-x 1 root root 831809 Srp 1 2015 libopencv_java300.so
-rwxr-xr-x 1 root root 300815 Srp 1 2015 opencv-300.jar
I have tried all possible combinations and still get the same error.
I do not know what else I could try to make this work.
The OpenCV works properly when I execute the c++ (Eclipse Luna) or python code.
My operating system is Ubuntu 14.04.
Any help is much appreciated.
Download OpenCV 2.4.11 or any version from this link https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.11/opencv-2.4.11.exe/download
Extract it.
Open eclipse.
Create a new Java Project.
Add the OpenCV jar.
Right click on the project.
Choose Build Path.
Click Configure Build Path.
Click Libraries.
Add External Jars.
Open OpenCV extracted folder.
Open build/java/
Choose opencv-2411.jar and open.
Click Apply.
Click Ok.
Add Native Library.
Click Edit button in the right side panel.
Click External Folde.
Open OpenCV extracted folder.
Open build/java/x64.(if your OS is 64bit choose x64 else x86)
Click Ok.
Click Apply.
Click Ok.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.