Mohamed Ali Lassoued
Mohamed Ali Lassoued

Reputation: 311

java.lang.UnsatisfiedLinkError: C:\...\xxx.dll: Can't load this .dll (machine code=0xbd) on a AMD 64-bit platform

I want to load DLL library to work with it but I have a little problem with this message

java.lang.UnsatisfiedLinkError: C:\xx\xx.dll: Can't load this .dll (machine code=0xbd) on a AMD 64-bit platform

and this is the code that i used to load my DLL library

String arch = System.getProperty(ARCH_OS_CONSTANT);
                if (arch.equals("32")) {
                    System.load("C:\\..\\xx.dll");
                } else if (arch.equals("64")) {
                    System.load("C:\\xx\\xx.dll");
                }

and still have the same problem and I hope that I've found a solution thanks

Upvotes: 0

Views: 2117

Answers (2)

Sebastian
Sebastian

Reputation: 51

I would guess you have the wrong Java-Runtime. Maybe you try to load it with the 32-Bit Java-Runtime and it needs to be 64-Bit or the other way around.

Upvotes: 0

Stephen C
Stephen C

Reputation: 719386

I am guessing that the value of ARCH_OS_CONSTANT is "os.arch" - the standard property name.

If so, your code is assuming that the value of "os.arch" for Intel/AMD 32 bit will be "32". That's not correct. According to this Q&A, the value will actually be "x86", and for Intel / AMD 64 bit it will be either be "amd-64" or "x86-64".

There is also a property called "sun.arch.data.model" that can have value "32" or "64". Unfortunately it is not one of the standard properties listed in the javadoc, and some JVMs don't support it.

Upvotes: 1

Related Questions