2

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

user1766169
  • 1,932
  • 3
  • 22
  • 44
Jürgen K.
  • 3,427
  • 9
  • 30
  • 66

2 Answers2

1

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");

vsaharan
  • 11
  • 3
0

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.

  • Your answer opens new questions. 1 Do I let the native library location in the java build path in eclipse to value "none" before exporting the project as jar? – Jürgen K. Jan 21 '16 at 12:50
  • 1
    Take a look at this link: http://stackoverflow.com/questions/661320/how-to-add-native-library-to-java-library-path-with-eclipse-launch-instead-of – Fausto Carvalho Marques Silva Jan 21 '16 at 14:15