Ask Your Question

Revision history [back]

Java + Netbeans - Error: "no opencv-310.jar in java.library.path"

I am trying to use opencv with java, but im having some issues. When i tried to run some code i got the error: "no opencv-310.jar in java.library.path". I've tried to set the "-Djava.library.path =" to "opencv-3.1.0/build/lib", and as a result the error changed to "Could not find or load main class".
I've also tried to get it running in the terminal. I could compile it, but when i tried running i got the same error (Could not find or load main class"). The code I tried running is:

public static void main(String[] args) {
    System.loadLibrary("opencv-310.jar");
    Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
    System.out.println("mat = " + mat.dump());
}

Anyone have an idea of how to fix this?
Thanks in advance for any replies.