I am trying to call a .dll file from my Java app using JNA. I am getting the following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'C:\Windows\System32\foo.dll': The specified module could not be found.
Both the .dll and my jdk are 32 bit (OS_ARCH="i586") although I am running it on a 64 bit Windows 7 PC.
The .dll is in the System32 folder.
I am using Eclipse and have added the System32 folder to the Native library location in the JRE System library under the Libraries tab in the Java Build Path Properties (although I don't think this should be necessary).
I would be grateful for any help or suggestions.
Thanks,
-Munk.
This is down to the file system redirector. You are executing under the WOW64 emulator that emulates 32 bit Windows on a 64 bit system. Under WOW64, the system32
is redirected to SysWOW64
. You'll need to put your DLL there.
With that said, the system directory is owned by, and private to, the system. You are expected not to put DLLs into the system directory. You should find a way to put your DLL in some other location.