1

I installed opencv using homebrew. There's no jar file. Can't seem to find the jar file. Tried downloading again - opencv 2.4.3, 2.4.7, 2.4.8. again tried to build but getting errors in the middle of building jar file. I'm trying to make a OpenCV Java project in Netbeans. I tried to look for jar file. Since it's not there, I build the Opencv but getting error.

Trying this to build OpenCv jar:

$ cd opencv-2.4.7

$ mkdir build

$ cd build/

$ cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -D CMAKE_C_COMPILER=/usr/bin/gcc -D WITH_CUDA=ON .. 

$make -j4 

$ make install

I'm on MacOSX 10.8.5. Any help would be greatly appreciated.

The error I'm getting is :

BUILD FAILED

/Users/ih/Downloads/opencv-2.4.7/build/build.xml:9: Class not
 found: javac1.8

 Total time: 0 seconds make[2]: *** [bin/opencv-247.jar] Error 1
 make[1]: *** [modules/java/CMakeFiles/opencv_java.dir/all] Error 2
 make[1]: *** Waiting for unfinished jobs.... Linking CXX shared
 library ../../lib/cv2.so [ 89%] Built target opencv_python make: ***
 [all] Error 2

Just to confirm I do have javac installed.

3
  • 2
    ... and the error is ? Commented Apr 9, 2014 at 17:02
  • I added a link. Here I pasted the error I got when building it. @berak Commented Apr 9, 2014 at 17:12
  • 1
    oh, no put it here, append it to your q. Commented Apr 9, 2014 at 17:19

2 Answers 2

1

Try using CMake instead of Homebrew (follow this tutorial).

Regards.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, I managed to finally built it. thank you! I was wondering where is the .jar file? I went into OpenCV-2.4.3/build/bin but it's not there?
1

I had the same problem previously, since my previous jdk used is 1.8. Then I solved it by set the jvm to the lower version. See what are the available versions:

/usr/libexec/java_home -V

for me, my versions are listed as:

Matching Java Virtual Machines (4):

1.8.0_25, x86_64: "Java SE 8" >/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home 1.7.0_60, x86_64: "Java SE 7" >/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home 1.6.0_65-b14-462, x86_64: "Java SE 6" >/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Then I simply set the java version by set JAVA_HOME:

export JAVA_HOME=/usr/libexec/java_home -v 1.7.0_60

Finally, the OpenCV installation went well! Hope it helps!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.