Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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