I am trying to set up JNA to talk to a custom DLL i have but to no avail
It keeps saying it is looking in the resource path in the lcoation /target/classes/
I was wondering is it possible to add a resource location where it can pick up my DLL?
My code is as follows
System.setProperty("jna.debug_load", "true");
System.setProperty("jna.debug_load.jna", "true");
System.setProperty("jna.platform.library.path", "C:\\Development\\dll\\");
Native.loadLibrary("customDLL", CustomDLL.class);
If I manually add the dll to the folder /target/classes/, the DLL loads as expected
I am using Eclipse Luna 32bit JDK 1.7.0_65 32 bit JNA 4.1.0
Any help is greatly appreciated
Thanks Damien
JNA looks in the location specified by the system property jna.library.path
, falling back to whatever path is in java.library.path
otherwise (which is mostly set based on PATH
from the environment).
You should make sure that eclipse copies the DLL to wherever the application will eventually expect to find it, and also ensure the eclipse properly sets jna.library.path
to that location when launching your JVM.
Note also that any dependent libraries must either by on PATH
or in the same directory as your target DLL.
See the JavaDoc for NativeLibrary for other variations on where JNA can load your native library.