When loading the library in my main src folder there is no problem, but in the test src folder I get the error. I can still compile and run all the tests normally and they pass.
Both src folder are in the path and I got opencv as a library. Like I said, everything is working, so I guess it's a problem with Eclipse and the display of the error which should not be displayed? So the main problem is that it's visually a pain.
EDIT2 : I just want to say again that everything is working, the tests are all running, it is simply that they pop as problems (and I don't see the errors of the tests because this unspecifiedlinkerror is before and overshadow them)
Also, it does the same thing on both my Windows and Ubuntu machine.
my path is also correct when I print it out right before the System.loadLibrary as .../opencv-2.4.11/build/lib
EDIT3 : I tried Cibin William answer and put my .dll path but to no avail
You can right on the project and click on Build Path
-> Configure Build Path
-> then select the Libraries
tab and select OpenCV
jar file and then expend it and then select on Native Library Location
and then click on the Edit
and then brows the to the .dll
file of OpenCV
something like this C:\opencv\build\java\x64
Or C:\opencv\build\java\x86
for 32bit System. And it is that.
Or You can load the library by coding (dynamically)
public static void loadOpenCV_Lib() throws Exception {
// get the model
String model = System.getProperty("sun.arch.data.model");
// the path the .dll lib location
String libraryPath = "C:/opencv/build/java/x86/";
// check if system is 64 or 32
if(model.equals("64")) {
libraryPath = "C:/opencv/build/java/x64/";
}
// set the path
System.setProperty("java.library.path", libraryPath);
Field sysPath = ClassLoader.class.getDeclaredField("sys_paths");
sysPath.setAccessible(true);
sysPath.set(null, null);
// load the lib
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With