How do I solve a java.lang.UnsatisfiedLinkError:no opencv_java455 in java.library.path: error?

1.1k views Asked by At

I have read through the info docs for bytedeco's opencv gitbub repo and searched extensively on the internet but could not find a solution that works.

I am trying to create an openCV javaFX application with gradle.

I am using this dependency in my gradle.build file: implementation group: 'org.bytedeco', name: 'javacv-platform', version: '1.5.7'

When I run System.loadLibrary(Core.NATIVE_LIBRARY_NAME);, Core.NATIVE_LIBRARY_NAME returns the correct opencv version (opencv_java455).

However, System.loadLibrary("opencv_java455") fails with this error: java.lang.UnsatisfiedLinkError: no opencv_java455 in java.library.path:

What would be the correct way to go about resolving this?

From my digging online, I think that I might be missing a .dylib file. However, I have no idea how to locate this file or how to point to it correctly. I do not see an opencv_java455.dylib file in the external libraries.

Thanks in advance for your help

Here is some more potentially useful information:

Operating system:

MacOS Monterey

M1 chip Macbook pro

Using intelliJ

1

There are 1 answers

0
Thomas On

There is a special method to call:

Loader.load(opencv_java.class);

Make sure javacpp is in the dependencies and this call will push all needed libraries into the javacpp cache. The manual call of loading any libraries is not needed then. At least this works for all platforms supported, make sure the correct platform libraries are in the classpath (javacpp-platform).