If the dll is in the folder of your project (for example, part of your project), that is:
./prod/bin/myAPI.dll
and you want to run the / unit test program inside eclipse, you can configure the runtime environment that runs your program. Go to the "Preferences / Java / Installed JREs" section, select the required JRE or JDK (note: to load a 32-bit DLL you must use a 32-bit JRE, although your host system is a 64-bit system), click "Change " In the "VM default arguments" field, you enter
-Djava.library.path="./prod/bin;${env_var:PATH}"
This adds your dll "prod / bin" folder in front of the system path (do not worry, this is not permanent, only for the environment selected by the JRE).
By running the following code, you can verify that the system path has been updated and the DLL can be downloaded:
String path = System.getProperty("java.library.path"); System.out.println(path); System.loadLibrary("myAPI");
source share