Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I get this error ONLY when I try to run as a groovy script, but not when I use the java classes. I use OpenCV 2.4.5 (installed via git as suggested in the intro to Java development OpenCV 2.4.5 document. Instead of using the ant build, I simply compile and then run SimpleSample.java which works fine, as in:

javac -cp ../build/bin/opencv-245.jar:. SimpleSample.java

java -cp ../build/bin/opencv-245.jar:. -Djava.library.path=../build/lib SimpleSample

My goal is to run this in groovy. I have groovy-fied SimpleSample.java as follows:

import org.opencv.core.Core

import org.opencv.core.Mat

import org.opencv.core.CvType

import org.opencv.core.Scalar

System.loadLibrary(Core.NATIVE_LIBRARY_NAME)

println("Welcome to OpenCV " + Core.VERSION)

def m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0))

println("OpenCV Mat: " + m)

...

I compile this with groovyc and then run it with java, which throws the exception.

groovyc -cp ../build/bin/opencv-245.jar:. TestGroovy.groovy

java -cp ../build/bin/opencv-245.jar:/usr/local/groovy/embeddable/groovy-all-2.1.4.jar:. -Djava.library.path=../build/lib TestGroovy

Welcome to OpenCV 2.4.5.0

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

I get this error ONLY when I try to run as a groovy script, but not when I use the java classes. I use OpenCV 2.4.5 (installed via git as suggested in the intro to Java development OpenCV 2.4.5 document. ). Instead of using the ant build, I simply compile and then run SimpleSample.java which works fine, as in:

javac -cp ../build/bin/opencv-245.jar:. SimpleSample.java

java -cp ../build/bin/opencv-245.jar:. -Djava.library.path=../build/lib SimpleSample

My goal is to run this in groovy. I have groovy-fied SimpleSample.java as follows:

import org.opencv.core.Core

import org.opencv.core.Mat

import org.opencv.core.CvType

import org.opencv.core.Scalar

System.loadLibrary(Core.NATIVE_LIBRARY_NAME)

println("Welcome to OpenCV " + Core.VERSION)

def m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0))

println("OpenCV Mat: " + m)

...

I compile this with groovyc and then run it with java, which throws the exception.

groovyc -cp ../build/bin/opencv-245.jar:. TestGroovy.groovy

java -cp ../build/bin/opencv-245.jar:/usr/local/groovy/embeddable/groovy-all-2.1.4.jar:. -Djava.library.path=../build/lib TestGroovy

Welcome to OpenCV 2.4.5.0

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

click to hide/show revision 3
No.3 Revision

I get this error ONLY when I try to run as a groovy script, but not when I use the java classes. I use OpenCV 2.4.5 (installed via git as suggested in the intro to Java development OpenCV 2.4.5 document). Instead of using the ant build, I simply compile and then run SimpleSample.java which works fine, as in:

javac -cp ../build/bin/opencv-245.jar:. SimpleSample.java

SimpleSample.java java -cp ../build/bin/opencv-245.jar:. -Djava.library.path=../build/lib SimpleSample

SimpleSample

My goal is to run this in groovy. I have groovy-fied SimpleSample.java as follows:

import org.opencv.core.Core
import org.opencv.core.Mat
import org.opencv.core.CvType
import org.opencv.core.Scalar
  

import org.opencv.core.Core

import org.opencv.core.Mat

import org.opencv.core.CvType

import org.opencv.core.Scalar

System.loadLibrary(Core.NATIVE_LIBRARY_NAME)

System.loadLibrary(Core.NATIVE_LIBRARY_NAME) println("Welcome to OpenCV " + Core.VERSION)

Core.VERSION) def m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0))

println("OpenCV Mat: " + m)

...

m) ...

I compile this with groovyc groovyc and then run it with java, which throws the exception.

groovyc -cp ../build/bin/opencv-245.jar:. TestGroovy.groovy

TestGroovy.groovy java -cp ../build/bin/opencv-245.jar:/usr/local/groovy/embeddable/groovy-all-2.1.4.jar:. -Djava.library.path=../build/lib TestGroovy

TestGroovy

Welcome to OpenCV 2.4.5.0

2.4.5.0 Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

org.opencv.core.Mat.n_Mat(IIIDDDD)J