Java – How to resolve this UnsatisfiedLinkError?

How to resolve this UnsatisfiedLinkError?… here is a solution to the problem.

How to resolve this UnsatisfiedLinkError?

Good morning

Today I started POC with SikuliX and Java. I would like to try the example association in this. Some screens are captured and searched here.

When I do this, I get the error:

[error] RunTimeAPI: loadLib: opencv_java not usable: 
java.lang.UnsatisfiedLinkError: no opencv_java in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, / usr/lib/jni, /lib, /usr/lib]
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.sikuli.script.FindInput2.<clinit>(FindInput2.java:17)
at org.sikuli.script.Finder.<init>(Finder.java:21)
at org.sikuli.script.Region.doCheckLastSeenAndCreateFinder(Region.java:2936)
at org.sikuli.script.Region.checkLastSeenAndCreateFinder(Region.java:2897)
at org.sikuli.script.Region.doFind(Region.java:2827)
at org.sikuli.script.Region.find(Region.java:2325)
at Apl.sikuliXHighlight(Apl.java:50)
at Apl.main(Apl.java:26)
Caused by: org.sikuli.script.SikuliXception: fatal: problem with native library: opencv_java
at org.sikuli.script.RunTime.terminate(RunTime.java:70)
at org.sikuli.script.RunTime.libsLoad(RunTime.java:792)
at org.sikuli.script.RunTime.loadLibrary(RunTime.java:949)
at org.sikuli.script.Finder2.<clinit>(Finder2.java:35)
... 8 more
[4346 debug] RunTimeAPI: ***** final cleanup at System.exit() *****

I added library to my POM .XML. But that didn’t help.

Am I using the wrong library?

Some additional information:
I use Intellij on an Ubuntu 18.10 machine.

Please let me know if I’m missing something. Thank you so much.

@Edit:

I have checked for possible duplicate posts. But I didn’t use OpenCV, but SikuliX. I only need OpenCV as a dependency (because it’s being used by SikuliX).

@Edit2:
After digging more and trying to follow the information in the link (duplicate), I found that this Use the required information on the system.

Solution

Check the java version first.

java -version

Then install OpenCV

sudo apt install libopencv3.2-java
sudo ln -s /usr/lib/jni/libopencv_java320.so /usr/lib/libopencv_java.so

Related Problems and Solutions