Skip to content

Instantly share code, notes, and snippets.

@fivesmallq
Created September 19, 2018 07:27
Show Gist options
  • Save fivesmallq/6dc744b7b86d68d112728183b35c4b5a to your computer and use it in GitHub Desktop.
Save fivesmallq/6dc744b7b86d68d112728183b35c4b5a to your computer and use it in GitHub Desktop.
How To Install OpenCV 3.3+ with Java on Mac
How To Install OpenCV 3.3+ with Java on Mac
03 Nov, 2017 • I spent a couple hours trying to resolve an UnsatisfiedLinkError with OpenCV and Java on Mac, I found the solution.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment