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
did you try doing it the ant way ? http://docs.opencv.org/doc/tutorials/...
I haven't, however when I want to add external jar's and dll's i've done that and it's worked. I did the same thing with Jinput ( access to joysticks) and rtxSerial (serial comm). And I can run those projects from the command line. I wonder what the difference is between OpenCV java implementation and any other library.