Compile openCV using JNI_VERSION_1_2

asked 2018-03-15 03:30:12 -0500

Mutpx gravatar image

Hi, I am trying to get openCV to play videos on my java application which uses jdk1.5 (not my choice, legacy codes). I have followed the steps to use CMake, python, ant, download the latest source codes (3.4.1 as of this post) and use VS2010 to try and compile openCV. I was able to get the solution file from CMake. But have some problems when compiling the jar and dll

1. There was an compile time error for jni-part.cpp where VS complains there is no JNI_VERSION_1_6, so I changed it to JNI_VERSION_1_2.

2. Under build/modules/java_bindings_generator/gen/java/org/opencv/highgui/ I had to remove the @Override annotations under new KeyListener (Line 88).

Was able to generate the opencv_java341.dll and opencv_java341.jar files successfully after I did this. However when using System.loadLibrary(Core.NATIVE_LIBRARY_NAME) results in java.lang.UnsatisfiedLinkError: opencv_java341.dll: The specified procedure could not be found.

I used dependency walker to look at what was wrong in the dll that was built, but there was nothing out of the oridnary. The only thing worth concerning was under KERNEL32.DLL for OPENCV_IMGCODECS341D.DLL there are 4 functions highlighted in red - InitializeConditionVariable, InitializeCriticalSectionEx, SleepConditionVariableCS, WakeConditionVariable.

First and foremost, can I even use JNI_VERSION_1_2 for opencv? If so, can how can I resolve this issue? Are the methods inside OPENCV_IMGCODECS341D.DLL causing this?

edit retag flag offensive close merge delete