I am loading a Windows DLL using Java but getting the following stack trace:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Files\name.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Any ideas as to how to fix this or is this dependent on the JDK used?
Yes, that's it. Just for your information, even on 32-bit Windows it is possible to run a virtualization software (eg. a VMWare, though a non-commercial alternatives surely exist) and install a 64-bit OS into that. You might only need to set up the BIOS to support 64 bit OS (I faintly remember I had to do so). This option can come in handy and might not be that obvious.
Plus, one more thing! You also need to run 64-bit JRE to use a 64-bit DLL. It is possible to run a 32-bit JRE on 64 bit system, in which case you also cannot link to a 64-bit DLL,
Joanne Neal wrote:It's a hardware issue. 64-bit DLLs don't work on 32-bit machines.
It's actually a software issue. It's the OS and calling application (in this case the JVM) that determine whether or not 64-bit DLLs can be used. You can take a 64-bit machine, with a 64-bit Windows, and a 32-bit JVM, and the 64-bit DLL still can't be used.
Of course you need a 64-bit Windows (or other OS) to run a 64-bit JVM, and you need a 64-bit machine to run a 64-bit OS.