java.lang.UnsatisfiedLinkError: Can't load AMD 64-bit .dll on a IA 32-bit platform

16,995

The Dll is compiled for 64 bit ( amd64 or x86_64 ) platform/cpu architecture while your windows OS/JVM/JRE installation is/are 32 bit.

Either get a 32 bit version of the dll or upgrade your working environment ( either OS or JVM/JRE installation

Share:
16,995
Computer Science
Author by

Computer Science

Updated on June 04, 2022

Comments

  • Computer Science
    Computer Science almost 2 years

    Encountered this java.lang.UnsatisfiedLinkError: Can't load AMD 64-bit .dll on a IA 32-bit platform when trying to run java file in netbeans ide. Not sure where to begin for debugging and fixing code.

    Source code follows:

    package demojni;
    public class Main {
       static {
          System.load("C:\\Users\\Nicholas1\\Documents\\NetBeansProjects\\DemoJNI_Lib\\dist\\DemoJNI_Lib.dll"); // Load native library at runtime
                                       // hello.dll (Windows) or libhello.so (Unixes)
       }
    
       // Declare a native method sayHello() that receives nothing and returns void
    
    
       // Test Driver
       public static void main(String[] args) {
          new Main().sayHelloWorld();  // invoke the native method
       }
       private native void sayHelloWorld();
    }
    
  • Computer Science
    Computer Science about 7 years
    Great, thank you for your timely response. My Os is Windows 8 64-bit, how do I check the version of JRE. Also the JRE is 32-bit then how to upgrade just the JRE to 64-bit?
  • Computer Science
    Computer Science about 7 years
    I run the java -version with command prompt and it returned the version and not the xx-bit; java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode, sharing)
  • Sheinbergon
    Sheinbergon about 7 years
  • Computer Science
    Computer Science about 7 years
    Great it return "32". Now what? Do I only upgrade the JRE on my machine, and if so how?
  • Sheinbergon
    Sheinbergon about 7 years
    Remove the JRE installation and make sure you download the x64 version from here - oracle.com/technetwork/java/javase/downloads/…. Also please accept my answer once you're done :)
  • Computer Science
    Computer Science about 7 years
    I went to oracle.com/technetwork/java/javase/downloads/… and download the "Windows x64" for "Java SE Runtime Environment 8u121". After the install was complete I ran the System.getProperty("sun.arch.data.model"); again in netbeans and it returned 32 again. I will accept your answer, but What can I do now?
  • Sheinbergon
    Sheinbergon about 7 years
    Make sure your netbeans IDE is not using an internal JDK. What does it say under Tools -> Java Platforms ?
  • Computer Science
    Computer Science about 7 years
    Netbeans Java Platform Manager says; "JDK 1.6 (default)" under J2SE. found at C:\Program Files\Java\jdk1.6.0. What does that mean?
  • Sheinbergon
    Sheinbergon about 7 years
    Jesus, that's old. Change it use the one you just installed ( should be Jdk1.8*) in ProgramFiles or ProgramFiles (x86)
  • Computer Science
    Computer Science about 7 years
    Yes, this is true. Netbeans will not allow me to remove jdk 1.6, I added the JDK 1.8 as a Platform, how do I change the default to JDK 1.8?
  • Sheinbergon
    Sheinbergon about 7 years
    Project -> (Right-Click) Properties -> Build -> Compile -> Java Platform I'd strongly advise to reinstall Netbeans and upgrade to a newer version, as I'm assuming your netbeans is as old as your jdk1.6
  • Computer Science
    Computer Science about 7 years
    What was that extention for, was it for default jdk? Also I'm upgrading my netbeans now.
  • Computer Science
    Computer Science about 7 years
    Do you know why the "System.getProperty("sun.arch.data.model");" is returning 32bit even after the JRE update to 64bit?
  • Computer Science
    Computer Science about 7 years
    Do you think the old JDK 1.6 is the issue? Do you think it could be incorrect environment variables?
  • Computer Science
    Computer Science about 7 years
    Finished install of Netbeans 8.2, the JDK for Netbeans location is C:\Program Files\Java\jdk1.8.0_111. Does this look right?
  • Sheinbergon
    Sheinbergon about 7 years
    Yep, that seems about right. your programs probably still executed under the older 1.6 JDK, that's all.
  • Computer Science
    Computer Science about 7 years
    Do you know why the "System.getProperty("sun.arch.data.model");" is returning 32bit even after the JRE update to 64bit? Do you think the old JDK 1.6 is the issue? Do you think it could be incorrect environment variables
  • Computer Science
    Computer Science about 7 years
    Finally the "System.getProperty("sun.arch.data.model");" is returning 64bit, probably because of the JDK 1.6, How can I ensure the other programs run on the newer JDK 1.8? Wierdly enough now I cant access Project->Properties directly, I have to Project->(right click)->Set Configurations-> Customize. Could this be a bug in the new IDE? Also my java project compiling is running into a new runtime error, # A fatal error has been detected by the Java Runtime Environment: # EXCEPTION_ACCESS_VIOLATION
  • Sheinbergon
    Sheinbergon about 7 years
    What's inside ``` C:\Users\Nicholas1\Documents\NetBeansProjects\DemoJNI\hs_err‌​_pid34736.log ``` ?. Are you able to compile your app/code and run it separately ?
  • Computer Science
    Computer Science about 7 years
    Thread information, very similar to this link stackoverflow.com/questions/9986227/…. Some said its a JRE bug. And when I changed my Netbeans-6.9.2 IDE default JDK to JDK 1.7 I didnt get the same runtime project error. but when I changed the Netbeans-6.9.2 IDE default JDK to JDK jdk1.8.0_111 Netbeans crashes on restart. I used this link to change default JDK for Netbeans: stackoverflow.com/questions/2809366/…
  • Computer Science
    Computer Science about 7 years
    Here is the link to my error: stackoverflow.com/questions/43313847/… Right now I am able to compile and run clean/builds of my project but getting a successful run is not happening. Also my other java projects work fine.