I have installed OpenCv-3.1.0 in ubuntu-14.04. When I check the installation by typing "pkg-config --modversion opencv", I get the output as "3.1.0". I think that means installation is successful. I want to use it in IntelliJ IDEA. I'm trying to add the .jar file as a library. But opencv.jar file can not be found in the bin folder.
-
If the installation is successful the .jar file should be under bin folder. May be check for any installation issues – Bhugy May 12 '16 at 07:15
-
1possible duplicate of http://stackoverflow.com/questions/18873017/where-to-get-the-jar-for-opencv – Kirby May 12 '16 at 16:28
-
1I don't think the main OpenCV package includes the respective Java bindings. – E_net4 May 12 '16 at 16:31
-
@E_net4 yes you are correct. You must specify it with the flag `--with-java` – mccoyLBI Dec 07 '16 at 20:23
2 Answers
Installation can be done as in this link. Even after installing properly, I couldn't find the needed jar file.
I was able to fix this issue by installing "Apache Ant" and proceeded again with "cmake" and "make" commands.
I think this happens because OpenCV is in C/C++ and I need it in Java. Apache Ant is a Java library and command-line tool and can also be used effectively to build non Java applications, for instance C or C++ applications. That helped to build the needed jar file.

- 303
- 3
- 12
You may have forgotten to specify the --with-java
parameter
brew tap homebrew/science
brew install opencv --with-java
After compiling, a jar file should be in the path
/usr/local/Cellar/opencv/2.4.9/share/OpenCV/java/opencv-249.jar
For those not using mac OS X, you could try this:
brew install ant
brew edit opencv
Add -DBUILD_opencv_java=ON
to the args array.
brew install opencv

- 171
- 14
-
@E_net4 see my revised answer where it says "For those not on mac OS X" – mccoyLBI Dec 12 '16 at 14:40
-
You must be confused. Not only would this never solve my problem, it is also not my question. – E_net4 Feb 17 '17 at 15:30