Reputation: 392
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.
Upvotes: 1
Views: 838
Reputation: 1873
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!
Upvotes: 1