Reputation: 136
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.
Upvotes: 1
Views: 8125
Reputation: 1
If you want to configure OpenCV in windows using eclipse follow these steps:
Add the OpenCV jar.
You can use OpenCv Native Library by:
Adding the native library to your opencv jar
Point to Native Library in java class
Upvotes: 0
Reputation: 136
Ok, well, found the solution. This line of code needs to be added in main:
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Upvotes: 5