UnsatisfiedLinkError given by Highghui.imread() on java [closed]

asked 2013-09-03 06:18:50 -0500

minly gravatar image

updated 2013-09-03 06:23:57 -0500

I want to use opencv in eclipse, so I built the opencv with java, and used it in eclipse. But I ran into the following problem when reading image using imread().

 Mat image = Highgui.imread("f:/smoothed1.jpg");

Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.highgui.Highgui.imread_1(Ljava/lang/String;)J
    at org.opencv.highgui.Highgui.imread_1(Native Method)
    at org.opencv.highgui.Highgui.imread(Highgui.java:352)
    at HelloCV.main(HelloCV.java:12)

Environment: win7 64bit opencv-2.4.6 jdk1.7.0_21

I searched a lot and have checked the native library path, but not work. So, any help is appreciated. Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Andrey Pavlenko
close date 2013-09-09 10:10:48.287139

Comments

1

is it only imread ? or a general problem ?

did you add the path to the opencv-dlls to your PATH env var ?

(since the code in the opencv.jar depends on finding the dlls)

berak gravatar imageberak ( 2013-09-03 06:29:43 -0500 )edit

U r right, it is a general problem. I put the directory that contains opencv-java246.dll in PATH and CLASSPATH. And opencv libs were indeed chosen to be built as static libs. But the problem is still there.

minly gravatar imageminly ( 2013-09-03 08:46:55 -0500 )edit

I have found where the problem is. I should load the native library in the code which I didn't realized before. I really should look at the example in opencv first.

minly gravatar imageminly ( 2013-09-04 01:13:07 -0500 )edit