Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
 
'WOW'! Thanks!!! I'll give that a crack and let you know how it goes. –  Munk Fachine Jul 17 at 12:11
 
Yup! Worked a treat!! Thanks David! –  Munk Fachine Jul 17 at 12:11
 
I'm trying to get this .dll working in the Processing environment without much joy. I've posted a new thread here and would be grateful for any responses. Thanks @David-Heffernan for your responses to this thread. –  Munk Fachine Jul 22 at 14:28

Another reason for error is that the dll is only supported for 32 version not for 64 bit OS. You have to confirm the dll vendor.

share|improve this answer
 
That can hardly be true. If it was true, how would 32 bit Java be executing? –  David Heffernan Jul 17 at 12:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.