Ask Your Question

Revision history [back]

OpenCV Java Ubuntu UnsatisfiedLinkError

I installed Oracle Java from WebUpd8 and am trying to get OpenCV working according to these instructions.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install -y oracle-java7-installer oracle-java7-set-default build-essential cmake
$ sudo update-java-alternatives -s java-7-oracle
$ cd opencv/build
$ cmake -DBUILD_SHARED_LIBS=OFF ..
$ make
$ scala -cp /home/parallels/opencv/build/bin/opencv-248.jar -Djava.library.path=/home/parallels/opencv/build/lib
scala> import org.opencv.core._
scala> System.loadLibrary(Core.NATIVE_LIBRARY_NAME)
scala> val m:Mat = Mat.eye(3,3,CvType.CV_8UC1)

As far as I can tell, this is correct, but I keep running into the following error:

java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_eye(III)J
    at org.opencv.core.Mat.n_eye(Native Method)
    at org.opencv.core.Mat.eye(Mat.java:1467)
    at .<init>(<console>:10)
    at .<clinit>(<console>)
    at .<init>(<console>:11)
    at .<clinit>(<console>)
    at $print(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
    at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
    at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
    at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
    at java.lang.Thread.run(Thread.java:744)

What could be causing this? How do I remedy this?