Java - Loading dlls by a relative path and hide them inside a jar
- by supertreta
Hi guys,
I am developing a Java application that should be release as a jar. This program depends on c++ external libraries called by JNI. To load them, I use the method System.load with an absolute path and this works fine.
However, I really want to "hide" them inside the jar, so I have created a package to collect them. This forces me to load an relative path - the package path. By this approach, I let the user run the jar in any directory, without being worried about linking the dll's or bored with a previous installation process.
This throws the expected exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library
How can I get this working?
Thanks for your help!