Importing DLL into Eclipse Java project
Solution 1
Don't put ".dll" at the end of your library. That is a Windows-specific extension, and your call will work on other systems with other extensions, so putting the extension on is incorrect. Just load "myAPI" and, if that's the right names and other things are as advertised, it will work.
Solution 2
One option is to try keeping that dll in your /jre/bin used in eclipse system library and was able to configure dll files at runtime , by placing dll in /jre/bin
It is the simplest way i could find out. This work for me.Hopefully will help you.:)
Klausos Klausos
Updated on June 05, 2022Comments
-
Klausos Klausos almost 2 years
To import DLL into Eclipse Java project, I checked the "java.library.path"
String path = System.getProperty("java.library.path"); System.out.println(path);
One of the
path
values was equal toC:/Windows/System32
. Therefore I savedmyAPI.dll
inC:/Windows/System32
. Then I calledSystem.loadLibrary
:System.loadLibrary("myAPI.dll");
And got the error message:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: myAPI.dll at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source)
BTW, I tried to put my DLL file in different other directories that was mentioned in
path
. But each time I got the same error message. How to solve this problem?