Java - Can't find dependent libraries
So I built OpenCV with CMake using Visual Studio 2017 and I'm trying to use the Java bindings.
I built it with "cmake.exe --build . --config Release --target INSTALL".
In IntelliJ, I add the JAR as a library and add the native library location D:\Documents\opencv\opencv2\opencv-3.4.1\build\install\java, which contains opencv_java341.dll.
When I try to run my java code, I get the error Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Documents\opencv\opencv2\opencv-3.4.1\build\install\java\opencv_java341.dll: Can't find dependent libraries.
One thing I noticed is that when I tried with the prebuilt version (which seems to work but doesn't have the contrib modules), opencv_java341.dll is 45,140 KB while the one I built is only 2,063 KB.
What should I do?
you probably did NOT build with
BUILD_SHARED_LIBS=OFF
, so your opencv_java.dll depends on the other opencv libs, like opencv_core.dll opencv_imgproc.dll, etc.those must be found at runtime, so put your opencv/build/install/bin folder on the system's PATH variable.