# slight ambiguity in opencv java tutorial

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:

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"):

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:

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 close merge delete

Sort by » oldest newest most voted
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/)

more

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

more

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

more

Official site

GitHub

Wiki

Documentation