Wojciech D
Wojciech D

Reputation: 11

OpenCV java libjpeg.so.8: cannot open shared object file: No such file or directory

I have built the OpenCV 4.5.5 package with contrib modules using instructions from the OpenCV website. Everything went well, except now when I'm trying to load the OpenCV libraries in my java app i get the following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/wojciech/Downloads/opencv-4.5.5/build/lib/libopencv_java455.so: libjpeg.so.8: cannot open shared object file: No such file or directory

This is the line of code that causes the issue:

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

I have of course set VM options in IntelliJ to:

-Djava.library.path=/home/wojciech/Downloads/opencv-4.5.5/build/lib

And here is how i'm loading the library in gradle:

dependencies {

testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
implementation files('/home/wojciech/Downloads/opencv-4.5.5/build/bin/opencv-455.jar')
}

I have libjpeg.so.8 installed on my system, I have also tried copying it to the lib folder of OpenCV but it didn't help. I am really stuck. My os is PopOS 21.10

Upvotes: 0

Views: 729

Answers (1)

Wojciech D
Wojciech D

Reputation: 11

I managed to build and use the opencv on Ubuntu 20.04.03 LTS, so it seems like PopOS or Ubuntu 21.10 has something to do with the issue. For now I installed Ubuntu and everything works fine.

Upvotes: 1

Related Questions