File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Load DLL but getting Can't load AMD 64-bit .dll on a IA 32-bit platform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Load DLL but getting Can Watch "Load DLL but getting Can New topic
Author

Load DLL but getting Can't load AMD 64-bit .dll on a IA 32-bit platform

Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208
Hi,

Any information on this would be great,

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 java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1732)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at Test.main(Test.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Any ideas as to how to fix this or is this dependent on the JDK used?

Thanks in Advance,

Niall
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3532
    
  15
The error message suggest to me you're trying to load a 64-bit DLL on a 32-bit platform.


Joanne
Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208
Aye, i think so as well,

but is a Java JVM issue or a hardware issue?

Is there a way around this?

Thanks
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3532
    
  15
It's a hardware issue. 64-bit DLLs don't work on 32-bit machines.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Joanne Neal wrote:It's a hardware issue. 64-bit DLLs don't work on 32-bit machines.

Or more specifically, they don't work on 32-bit Windows (even on 64-bit machines).
Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208
Cool, Thanks for the info,

So there is no way around this, except for either:
* getting the 32-bit Windows version of the DLL
* getting a 64-Windows OS installed on the computer
?

Cheers
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

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,
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14145
    
  18

There's no way around this; you must either get a 32-bit version of the DLL, or run your program on a computer with 64-bit Windows (and 64-bit Java) installed.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Niall Loughnane
Ranch Hand

Joined: Dec 07, 2006
Posts: 208
Cool,

Thanks for all the info,

Cheers
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Load DLL but getting Can't load AMD 64-bit .dll on a IA 32-bit platform