Java - Loading dlls by a relative path and hide them inside a jar

Posted by supertreta on Stack Overflow See other posts from Stack Overflow or by supertreta
Published on 2011-01-14T12:35:26Z Indexed on 2011/01/14 12:53 UTC
Read the original article Hit count: 164

Filed under:
|
|
|
|

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!

© Stack Overflow or respective owner

Related posts about java

Related posts about jar