Programminghobby
Programminghobby

Reputation: 115

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

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();
}

Upvotes: 2

Views: 21556

Answers (3)

Programminghobby
Programminghobby

Reputation: 115

Solved the architecture error.

Lamans explanation for Error: OS was 64-bit, I Had 64-bit compiled .dll library and a 32-bit JDK 1.6.

Solution: I updated my JAVA_HOME variable from (JDK 1.6 32-bit) to (JDK 1.8 64bit).

  • Changed Java/JRE/JDK to 64bit environment
  • Ugraded Java/JRE/JDK environment to JDK 1.8
  • Upgraded from "Netbeans 6.9.1" to "Netbeans 8.2"
  • Upgraded Netbeans "Default JDK" from "JDK 1.6" to JDK 1.8 worked.

Note: Netbeans JDK version can be found from IDE accessing Tools->Java Platforms->Platforms or use link "Changing java platform on which netbeans runs" to change default JDK for netbeans.

Upvotes: 0

Finit
Finit

Reputation: 63

In my situaton, I just promise that Tomcat's bit was the same as the JDK's bit. I think this error doesn't matter to coding tools such as eclipse ,and bit of operating system.

Upvotes: 0

Sheinbergon
Sheinbergon

Reputation: 3063

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

Upvotes: 3

Related Questions