Unable to load Java library

1
Hi all, I'm having a problem loading an OpenCV library in Java using the following line of code: System.loadLibrary(Core.NATIVE_LIBRARY_NAME); When running locally (on Windows), the code runs like a charm. However, if I'm trying to run this application in the cloud (Linux enivornment), I'm getting the following error: CRITICAL - M2EE: java.lang.UnsatisfiedLinkError: no opencv_java342 in java.library.path I already added  the .dll and .so files (names opencv_java342.dll and libopencv_java342.so) to my /resources folder.  Another way I tried to load the library is using: String openCvFileLoc = new File(Core.getConfiguration().getResourcesPath() + File.separator + libName).getAbsolutePath(); System.load(openCvFileLoc); This also works locally on my Windows computer, but when in the cloud, an error occurs when loading the library.  Anyone any idea on what's going wrong? Am I putting files in the wrong directory, or do I have to add the resources folder to the Classpath of Java?  Thanks in advance. EDIT: I just noticed that the .so file from the resources folder is not copied to my deployment package (/model/resources). Anyone know how to prevent this from happening? EDIT2: I added the .SO files manually to my deployment package, however, I now get the following error: CRITICAL - M2EE: java.lang.UnsatisfiedLinkError: /home/vcap/app/data/tmp/project-userlib___415031196935836591/libopencv_java342.so: /home/vcap/app/model/resources/libopencv_ml.so.3.4: file too short
asked
1 answers
0

If the OpenCV contain DLL's they are platform specific and will only work on for example Windows. Mendix cloud runs on Linux so that will never work. If you run on premises, try to copy all files (dll etc) to the userlib.

answered