2

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.

Erandi Ganepola
  • 303
  • 3
  • 12
  • 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
  • 1
    possible duplicate of http://stackoverflow.com/questions/18873017/where-to-get-the-jar-for-opencv – Kirby May 12 '16 at 16:28
  • 1
    I 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 Answers2

2

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.

Erandi Ganepola
  • 303
  • 3
  • 12
1

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

mccoyLBI
  • 171
  • 14