Ask Your Question
2

slight ambiguity in opencv java tutorial

asked 2013-03-02 14:22:01 -0600

schtinky gravatar image

updated 2013-03-02 14:32:49 -0600

I'm confused about a part of the java tutorial found here:

http://docs.opencv.org/trunk/doc/tutorials/introduction/desktop_java/java_dev_intro.html

Particularly this part:

image description

It seems like a step or two has been skipped. It indicates that you should click on the "edit" button in the first image, but the dialog that pops up is not the second image shown. Instead, the dialog I get is one asking for the location of the native libraries. I have tried multiple locations but can't figure out which one is correct. I continue to get this error when running one of the sample programs with System.loadLibrary("opencv_java244"):

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java244 in java.library.path

Only after selecting a location for the native library do you then get the "add library" second dialog in the image I attached above. In other words, the tutorial skips over where to get the native libraries. Sorry if that seems trivial, but it's not for me.

Confused about my git version 2.4.9 and the "opencv_java244" line (from a previous version of the tutorial), I also tried "opencv_java249" without luck. Updating to "Core.NATIVE_LIBRARY_NAME" from the newer tutorial (2/28/2013) and giving the library setup my best shot (opencvbuildpath/lib), I get an error on Core.NATIVE_LIBRARY_NAME like so:

image description

Mousing over the error says "NATIVE_LIBRARY_NAME cannot be resolved or is not a field".

My apologies if these are trivial errors, but I've been a pure java guy my entire life and don't fully understand this native library tie-in stuff. I'm just thankful I got through the cmake process.

Thanks again for the tutorial, hopefully you can help me get over this last hurdle. Much appreciated.

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2013-03-04 05:28:30 -0600

Andrey Pavlenko gravatar image
  1. I suggest you use the 2.4 git branch instead of master

    git checkout 2.4

  2. Set the "Native Library location" to the path to the directory containing libopencv_java244.so (usually it's .../build/libs/)

edit flag offensive delete link more
-1

answered 2013-04-21 06:46:59 -0600

Pradeep gravatar image

To fix it do the following in eclipse

  1. Right Click your eclipse project > Build Path > Configure Build Path
  2. Select openCV library and click Edit
  3. Click User libraries
  4. Expand openCV and select Native Libraries
  5. Click Edit and browse to the path where you copied build/java folder
  6. Select x64 in case of AMD else x86 folder.
  7. Remember the dll file name and use the same under System.LoadLibrary()

Hope that helps

edit flag offensive delete link more
0

answered 2013-08-16 03:32:33 -0600

DM1 gravatar image

On 2.4.6 I used opencv\build\java\x64\ where opencv_java246.dll is located, and that solved the problem.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-02 14:22:01 -0600

Seen: 6,201 times

Last updated: Aug 16 '13