Ask Your Question

Problem with Java tutorial(UnsatisfiedLinkError)

asked 2013-12-28 07:38:07 -0600

rafaelromcar gravatar image

updated 2013-12-28 07:45:55 -0600

Hi, it's my first question and I'm really sorry about do the same like all people but I can't find the solution. I have tried to do the basic java tutorial and I have done all steps and finally I have a UnsatisfiedLinkError when I try to run the Dectect Faces Demo.

I have opencv in ~/Trabajo/opencv/ there I have my build/bin and build/lib maked without errors. I work with opencv-248(I have done checkout 2.4 and got that). My project is in ~/Trabajo/JAVA/JavaSample/

The first example runs perfect. Without warnings or something like that and for the last part(Copy the OpenCV jar and write a simple application) I have just modified a code line:

System.loadLibrary("opencv_java244"); has to be System.loadLibrary("opencv_java248");

It works in the first exemple but here it says:

*Hello, OpenCV [error] (run-main-0) java.lang.UnsatisfiedLinkError: no opencv_java248 in java.library.path java.lang.UnsatisfiedLinkError: no opencv_java248 in java.library.path at java.lang.ClassLoader.loadLibrary( at java.lang.Runtime.loadLibrary0( at java.lang.System.loadLibrary( at HelloOpenCV.main( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( [trace] Stack trace suppressed: run last compile:run for the full output. java.lang.RuntimeException: Nonzero exit code: 1 at scala.sys.package$.error(package.scala:27) [trace] Stack trace suppressed: run last compile:run for the full output. [error] (compile:run) Nonzero exit code: 1*


I have done the next steps into my project folder(~/Trabajo/JAVA/JavaSample/)

mkdir lib
cp ~/Trabajo/opencv/build/bin/opencv-248.jar lib/
sbt eclipse
mkdir src/main/resources
cd src/main/resources
cd ~/Trabajo/JAVA/JavaSample/
cp ~/Trabajo/opencv/data/lbpcascades/lbpcascade_frontalface.xml src/main/resources/
vim src/main/java/ //I copied the code exemple in the file and modified the line I said before
sbt run //and then, the error I copied before

I don't know what I should do. Thanks for your help and great work!

edit retag flag offensive close merge delete


have you changed the path of java library i.e.--Djava.library.path="path to your library"?

vivek0402 gravatar imagevivek0402 ( 2014-01-01 03:34:08 -0600 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-01-16 08:28:59 -0600

Hi, I had the same problem but solved it.

When I added the opencv-248.jar to User Libraries, the Native Library location field was blank. Setting this to .../build/java/x64 directory fixed the error for me.

edit flag offensive delete link more

answered 2014-01-01 03:37:41 -0600

vivek0402 gravatar image

Try System.load("absolute path to your opencv_java248.dll ") instead of System.loadLibrary(). and change java library path to -Djava.library.path="absolute path to your opencv_java248.dll".

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-12-28 07:38:07 -0600

Seen: 9,397 times

Last updated: Jan 16 '14