UnsatisfiedLinkError Using JavaCV in Eclipse on Mac

I am sure this will be some kind of PATH problem, but I am not sure where I am going wrong. I am trying to get JavaCV to work in my project in Eclipse, so I can do circle detection on images, but get the following exception that Eclipse raised when trying to run one of the sample projects:

java.lang.UnsatisfiedLinkError 

I tried to follow these instructions: http://code.google.com/p/javacv/

I have javacv.jar and jna.jar in the BuildPath of my project. What do I need to do to add the right files to the right paths to get JavaCV working?

I tried adding jar files to $ CLASSPATH but getting the same error. I downloaded and installed OpenCV, not sure what from this folder I need to add to $ PATH. Any help is appreciated.

+4
source share
4 answers

The UnsatisfiedLink error means that one or more files in the source library cannot be associated with your program. This is most often due to the fact that the source library files are not where the JVM looks.

See section 2.7 http://java.sun.com/docs/books/jni/html/start.html for more details.

+2
source

Can you put all the error in the application. Sometimes the problem may be the incompatibility of the two versions of javacv and opencv. So try to check if you have compatible versions.

+2
source

I also get the same exception when I try to run my first javacv application. I also try different things, and finally I found that incompatible versions are the reason for this exception. So it may be in your problem.

+2
source

I also ran into a similar problem, I tried to create OpenCV from the source, and also using MacPorts. Then I tried to configure the root paths of the library in eclipse to point to where OpenCV was created, but this does not work for me. Finally, I solved the problem by installing OpenCV via Macports, which installs all .dylib in the path "/ opt / local / lib". After that, I ran the following shell script (specified in http://code.google.com/p/javacv/wiki/HowToMakeAnApplet )

 BADPATH=/opt/local/lib for f in libopencv*2.4.dylib; do install_name_tool $f -id @rpath/$f \ -add_rpath /usr/local/lib/ -add_rpath /opt/local/lib/ -add_rpath @loader_path/. \ -change $BADPATH/libopencv_core.2.4.dylib @rpath/libopencv_core.2.4.dylib \ -change $BADPATH/libopencv_calib3d.2.4.dylib @rpath/libopencv_calib3d.2.4.dylib \ -change $BADPATH/libopencv_features2d.2.4.dylib @rpath/libopencv_features2d.2.4.dylib \ -change $BADPATH/libopencv_flann.2.4.dylib @rpath/libopencv_flann.2.4.dylib \ -change $BADPATH/libopencv_gpu.2.4.dylib @rpath/libopencv_gpu.2.4.dylib \ -change $BADPATH/libopencv_highgui.2.4.dylib @rpath/libopencv_highgui.2.4.dylib \ -change $BADPATH/libopencv_imgproc.2.4.dylib @rpath/libopencv_imgproc.2.4.dylib \ -change $BADPATH/libopencv_legacy.2.4.dylib @rpath/libopencv_legacy.2.4.dylib \ -change $BADPATH/libopencv_ml.2.4.dylib @rpath/libopencv_ml.2.4.dylib \ -change $BADPATH/libopencv_nonfree.2.4.dylib @rpath/libopencv_nonfree.2.4.dylib \ -change $BADPATH/libopencv_objdetect.2.4.dylib @rpath/libopencv_objdetect.2.4.dylib \ -change $BADPATH/libopencv_photo.2.4.dylib @rpath/libopencv_photo.2.4.dylib \ -change $BADPATH/libopencv_video.2.4.dylib @rpath/libopencv_video.2.4.dylib; done 

After running the above script, I just created a sample JavaCV project (used the sample code provided at http://www.cnblogs.com/ljsspace/archive/2011/08/05/2128948.html ) and was able to successfully run it from eclipses without installing any other paths.

+1
source

Source: https://habr.com/ru/post/1396048/


All Articles