Tomas Marik
Tomas Marik

Reputation: 4093

Installing OpenCV 3 on mac won't install jar

I am trying to install OpenCV3 on mac using:

brew tap homebrew/science
brew install opencv3 --HEAD --with-java

I would expect a jar lib in:

/usr/local/Cellar/opencv/3.3.0_3/share/OpenCV

But there in no jar in the whole project.

(I also added -DBUILD_opencv_java=ON flag via brew edit opencv3)

Upvotes: 4

Views: 1695

Answers (2)

Roma
Roma

Reputation: 333

igr is right. we do need to install ant before we install opencv. If you have already installed opencv and then find out the jars are missing, then you need to install ant and run the make on your own. I couldnt figure how to run the make. so I uninstalled opencv after installing ant and reinstalled opencv. and voila the jars were there as specified.

ls /usr/local/Cellar/opencv/3.3.1/share/OpenCV/java

libopencv_java331.dylib opencv-331.jar

Upvotes: 3

igr
igr

Reputation: 10624

I had the very same issue with the v3.3.0. I was following the documentation that says basically the following:

  • brew edit opencv
  • change -DBUILD_opencv_java=ON
  • brew install --build-from-source opencv

However, the java folder was missing in usr/local/Cellar/opencv/3.3.0_3/share/OpenCV, although there was no error report.

Fortunately, I figured what was the issue: the OpenCV requires ant to be installed! It is used to build a jar after all the java sources are generated. So, the solution in my case was:

brew install ant

and then repeating the above procedure. Note that --build-from-source is required in order to get the jar.

Upvotes: 8

Related Questions