I want to call a .DLL method in Eclipse. Here is my code :
class TestJNI1 {
public native void LireNoVersion();
public void a() {
System.loadLibrary("tttt.dll");
LireNoVersion();
}
}
public GlobalAction() {
this.setBackground(GlobalPreferences.PANEL_BACKGROUND_COLOR);
new TestJNI1().a();
}
The problem is that I have this error on compilation :
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: tttt.dll at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source)
I already tried to :
System.loadLibrary(...) and System.load(...)UPDATE
I tried to print the java.library.path and get a path. I put the dll in this path and the error message is more confusing now :
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: D:\My\Exact\Path\tttt.dll: Can't find dependent libraries
Here is the code to print the path :
String property = System.getProperty("java.library.path");
StringTokenizer parser = new StringTokenizer(property, ";");
while (parser.hasMoreTokens()) {
System.err.println(parser.nextToken());
}
The first problem was it couldn't find the dll because it wasn't in the path.
The second problem is that it can't find the dependencies on the dll that you are using. Your choices would seem to be
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With