I need to load a DLL is located somewhere out of my Jar file, but whenever I do try to run the Jar I get the following error:
java.lang.UnsatisfiedLinkError: E:\test.dll : Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
The issue is not from the DLL, it's compiled to 64 bit machine as my PC is 64 bit, it has no dependencies, the issue only occurs when running from the Jar, when I run the application through my Eclipse it runs fine and everything loads fine.
The code code I using to load the DLL is:
File libraryFile = new File("E:\test.dll");
Runtime.getRuntime().load(libraryFile .getPath());
I used Eclipse to Jar the application.
EDIT
I tried Jarring using different applications, such as Jar Maker
and Jar Builder
but nothing helps
EDIT 2 I tried to run this exact application, it works from the IDE but not from the Jarred file, tried moving the DLL but that didn't help as well:
public class Test {
public static void main(String[] args) throws Exception {
System.load("E:\\test.dll");
}
}