Ask Your Question

Java program Opencv unsatisfiedlinkerror

asked 2016-01-14 10:52:30 -0600

I have a java application designed to run in the Linux environment, developed using Opencv and Eclipse - Ubuntu 14.04. It runs fine inside Eclipse and produces a .jar on export. The program .jar works perfectly on the system where the opencv is installed.

java"/home/me" -jar program.jar

The library where opencv is installed has all the so files and links to so files in place and when I do a ldd on the it displays all the associated so files/links are aokay.

However on the machine where opencv is not installed:

I have been able to carry the libs over and create all the links using the ln command however I am still getting java.lang.unsatifiedlinkerror: /my/lib/ cannot open shared object file: No such file or directory

I did an ldd on and the result is => not found - one of several not founds in the opencv library.

The link is in the directory along with all the other correct link files and their corresponding so files. What am I missing here? I know I need get the to find the links but I don't know how.

The end point of this exercise is to make either a self contained executable, .jar or a combination of lib files and .jar to be distributed to end user in the linux environment.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-01-16 18:36:47 -0600

The answer is the Opencv libraries need to be stored on the installation machine in exactly the same directories as the production machine. In my case, I may have not used the right directories during my initial installation on the production machine - storing the opencv libraries in my workspace.

First, I created the same directories on the installation PC /home/me/OpenCV/opencv-3.1.0/build/lib and copied all the opencv libraries from the production machine into that directory.

Second, I used ldd /home/me/ to find the libraries with missing links.

Third, I used ln -s library.file name to create each link as named in the ldd output.

Fourth, I had to copy over and create links for some libraries stored in the system area /usr/lib and /usr/lib/x86_64-linux-gnu that were also highlighted as missing in the ldd output from

Finally, I was able to execute the program java -Djava.library.path="/home/me/OpenCv/opencv-3.1.0/build/lib" -jar program.jar

My next step will be to automate this process with either a shell or some other utility and zip files to contain all the data. I suspect that I should carry ALL the library files from the ldd output and create the links just in case the installation machine does not have any of them.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-01-14 10:52:30 -0600

Seen: 679 times

Last updated: Jan 16 '16