Ask Your Question
0

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(ClassLoader.java:1874) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1087) at HelloOpenCV.main(HelloOpenCV.java:47) 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) [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
wget http://docs.opencv.org/2.4.4-beta/_images/lena.png
cd ~/Trabajo/JAVA/JavaSample/
cp ~/Trabajo/opencv/data/lbpcascades/lbpcascade_frontalface.xml src/main/resources/
vim src/main/java/HelloOpenCV.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

Comments

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
1

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
0

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

Stats

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

Seen: 10,120 times

Last updated: Jan 16 '14