failed to use System.loadLibrary(Core.NATIVE_LIBRARY_NAME) on Raspberry pi
Hi All,
I compiled the opencv latest sources on my Raspberry pi (for java) and i got the following files (among others) libopencv_java400.so and opencv_java.jar
So far so good, but when i try to load the libopencv_java400.so library in my java program, it fails to do so saying that the source can't be found.
I have tried several ways to load the file and i get the following errors :
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
returns error (in debug mode):
Source not found.
Additionally, i have found that if i look inside the Core class in org.opencv.core , the return for this is :
private static String getNativeLibraryName() { return "opencv_java400"; }
and not libopencv_java400.so
did i miss something or is this correct ?
String libName = "";
libName = "libopencv_java400.so";
System.load(new File("/home/pi/workspace/ro.romaniasoft.FRI/libs/".concat(libName)).getAbsolutePath());
returns error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library:
/home/pi/workspace/ro.romaniasoft.FRI/libs/libopencv_java400.so
System.load("/home/pi/opencv/build/lib/libopencv_java400.so");
returns error (in debug mode):
Source not found.
I have added the native path in my Java Build Path - > opencv_java.jar -> native library location to "/home/pi/opencv/build/lib"
I also tried to copy the "libopencv_java400.so" to "/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm"
Apparently Nothing works. I'm stuck at this Load Library step.
Could you please help me ?
Thanks
Regards
can you try to rename or copy
libopencv_java400.so
toopencv_java400.so
?( getNativeLibraryName() is correct, the name of your so isn't )
Hi Berak, yes, i also tried renaming the file. Tired making several copies of both files in various locations. still nothing.
When executing the cmake command, shouldn't the script generate the .so file under the name opencv_java400.so directly ? Why am i getting the libopencv_java400.so ?
Thanks Regards