Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Java Link error when compiling from console (2.4.9)

Hi, when I try to compile and run a basic java program using openCV I get Link errors, however it compiles just fine. I've added opencv_java249.dll to my jre/bin folder, and opencv-249.jar to jre/lib/ext. My java version is 1.8.0_31 I can run java programs using openCV with eclipse without problems, importing the library as suggested in the documentation. The folder in which my source code is, contains also the opencv_java249.dll (although i really ignore if that helps)

import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar;

public class Test {

public static void main(String[] args) {
    System.loadLibrary("opencv_java249");
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

            Mat mm = new Mat();
}

}

When running, the exception I get is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat()J at org.opencv.core.Mat.n_Mat(Native Method) at org.opencv.core.Mat.<init>(Mat.java:447) at Test.main(Test.java:18)

Exceptions also happen if I try to access another Class, such as CascadeClassifier, so it is really a linker problem.

I hope someone can help.

Mike