2
votes

I need to create a runnable jar in Windows with Eclipse and start it with Linux

I'm getting an unsatisfiedLinkError while loading OpenCv. I have edited the correct library path for a Linux computer in Eclipse and finally created a runnable jar. When I start the *.jar file in linux and get the following error.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java2411 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1889) at java.lang.Runtime.loadLibrary0(Runtime.java:900) at java.lang.System.loadLibrary(System.java:1087)

Basically i have two question.
1. How can i get the loaded library path at runtime?
2. Is it possible that the chosen way is not the right way to handle the problem?

Thanks

2
Try looking at the variable LD_LIBRARY_PATH. - Fausto Carvalho Marques Silva
This question has an awesome answer to that :) stackoverflow.com/questions/37901505/java-opencv-from-maven - luizfzs

2 Answers

1
votes

One important this to keep in mind for loading linux libraries with System.loadLibrary, omit the lib prefix in the library name, for instance, if the library name is libxyz.so, your call would be:

System.loadLibrary("xyz");

0
votes

Set the path of OpenCV in the variable LD_LIBRARY_PATH. You can do it in the shell where you run the "jar". Use export command.