If after installing OpenCV on Mac via brew, such as by using

brew install opencv

Then you may be getting an error when trying to use `System.loadLibrary(Core.NATIVE_LIBRARY_NAME)` that says something like:

UnsatisfiedLinkError: no opencv_java331 in java.library.path

The solution to this is to reinstall OpenCV with the proper Java libs. Try the following steps:

brew install ant
brew edit opencv
# change -DBUILD_opencv_java=OFF to ON
brew uninstall opencv # if you installed opencv before
brew install --build-from-source opencv # Note: this may take a long time

You may also need to point your IDE to the Java lib location by using a JVM arg such as:

-Djava.library.path=/usr/local/Cellar/opencv3/XXX/share/OpenCV/java

Check out my other blog posts! If you found this post interesting, feel free to let me know either on Twitter (@Isaac_M_Jordan), or in the comments section below.

Enjoyed my post? Sign up to the newsletter to receive a small email when I post. No spam, I promise.