java.lang.UnsatisfiedLinkError:无法在 IA 32 位平台上加载 AMD 64 位 .dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43301251/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 07:19:07  来源:igfitidea点击:

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

javanetbeansjava-native-interfaceunsatisfiedlinkerror

提问by Computer Science

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.

遇到这个 java.lang.UnsatisfiedLinkError: Can't load AMD 64-bit .dll on a IA 32-bit platform 当试图在 netbeans ide 中运行 java 文件时。不确定从哪里开始调试和修复代码。

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

采纳答案by Sheinbergon

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.

Dll 是为 64 位( amd64 或 x86_64 )平台/cpu 架构编译的,而您的 Windows OS/JVM/JRE 安装是 32 位。

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

获取 32 位版本的 dll 或升级您的工作环境(操作系统或 JVM/JRE 安装

回答by Computer Science

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.

Lamans 对错误的解释:操作系统是 64 位,我有 64 位编译的 .dll 库和 32 位 JDK 1.6。

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

解决方案:我将我的 JAVA_HOME 变量从(JDK 1.6 32 位)更新为(JDK 1.8 64 位)。

  • 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.
  • 将 Java/JRE/JDK 更改为 64 位环境
  • 将 Java/JRE/JDK 环境升级到 JDK 1.8
  • 从“Netbeans 6.9.1”升级到“Netbeans 8.2”
  • 将 Netbeans“默认 JDK”从“JDK 1.6”升级到 JDK 1.8 工作。

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.

注意:Netbeans JDK 版本可以从IDE 访问Tools->Java Platforms->Platforms 或使用链接“更改运行netbeans 的java 平台”来更改netbeans 的默认JDK。

回答by Finit

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.

在我的情况下,我只是保证 Tomcat 的位与 JDK 的位相同。我认为这个错误与 eclipse 等编码工具和一些操作系统无关。