简体   繁体   English

如何使用64位/ 32位系统修复java.lang.UnsatisfiedLinkError问题?

[英]How to fix java.lang.UnsatisfiedLinkError-Problem with 64-bit / 32-bit Systems?

I hava a 64-bit System and want want to run a Java-Application that needs to load a 32-bit dll-file. 我有一个64位系统,并且想运行一个Java应用程序,该程序需要加载32位dll文件。 I want to load the libary using System.load() . 我想使用System.load()加载库。 When using a 64-bit Java-8-JRE the following error occurs: 当使用64位Java-8-JRE时,会发生以下错误:

java.lang.UnsatisfiedLinkError: C:\[...]\test.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform. 

When running the application on a 32-bit Java-6-JRE it sais 在32位Java-6-JRE上运行应用程序时,会提示

java.lang.UnsatisfiedLinkError: C:\[...]\test.dll: Can't find dependent libraries

I tried to use a 64-bit version of Java. 我尝试使用64位版本的Java。 Because the dll is a 32-bit dll I tried to run the application on a 64-bit-version. 因为该dll是32位dll,所以我尝试在64位版本上运行该应用程序。 But then another error occures. 但是随后又发生了另一个错误。

I also tried to use System.loadLibrary() instead. 我还尝试使用System.loadLibrary()代替。 But the errors seem to be similar. 但是错误似乎相似。

Java-8-64-bit: Java的8-64位:

java.lang.UnsatisfiedLinkError: C:\Windows\System32\test.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

--> Because of this error I can be sure java is able to find this file in general. ->由于这个错误,我可以肯定Java能够找到该文件。

Java-6-32-bit: Java的6-32位:

java.lang.UnsatisfiedLinkError: no test in java.library.path

--> Because of the error shown before the file have to be there. ->由于文件必须存在之前显示的错误。

My code of the application is very short: 我的应用程序代码很短:

Using System.load() : 使用System.load()

public static void main(String[] args) {
    System.load("C:\\[...]\\test.dll");
}

Using System.loadLibary() : 使用System.loadLibary()

public static void main(String[] args) {
    System.loadLibrary("test");
}

The file has all necessary permissions. 该文件具有所有必要的权限。

The typical error that the file is not in the PATH can be excluded because running a 64-bit-JVM the file can be found but can not be read because it needs a 32-bit JVM. 可以排除文件不在PATH中的典型错误,因为运行64位JVM可以找到文件,但由于需要32位JVM而无法读取文件。

Has anybody any ideas? 有任何想法吗? Thanks! 谢谢!

The solution is very simple... 解决方案非常简单...

Regarding the thread https://stackoverflow.com/a/12307577/11011623 the System32-folder, where my file and my dependencies have been, just allows 64-bit-binaries to be in it. 关于线程https://stackoverflow.com/a/12307577/11011623,System32文件夹(我的文件和依赖项所在的位置)只允许其中包含64位二进制文​​件。 So the 32-bit-dll was not found. 因此找不到32位dll。 When using System.load() and the dll at another path the system was not able to locate the necessary dependencies in the dll because the path where the dll is, is not part of the path... 在其他路径上使用System.load()和dll时,系统无法在dll中找到必要的依赖项,因为dll所在的路径不属于该路径...

Solution was to move all necessary files from System32 to Windows folder or to add a custom folder with all dlls and its dependencies to the PATH. 解决方案是将所有必需的文件从System32移到Windows文件夹,或将包含所有dll及其依赖项的自定义文件夹添加到PATH。 Thanks for all comments that helped solving this problem. 感谢所有有助于解决此问题的意见。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.lang.UnsatisfiedLinkError:无法在Windows中的64位JVM上加载32位SWT库 - java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM in windows java.lang.UnsatisfiedLinkError:dlopen失败:.so库是64位而不是32位 - java.lang.UnsatisfiedLinkError: dlopen failed: .so library is 64-bit instead of 32-bit java.lang.unsatisfiedlinkerror无法加载amd 64位.dll ia 32位 - java.lang.unsatisfiedlinkerror can't load amd 64-bit .dll ia 32-bit 如何在32位和64位系统上运行exe Java应用程序? - How can i run my exe Java application on both 32-bit and 64-bit systems? java.lang.UnsatisfiedLinkError:dlopen在64位而不是32位上失败,而.so应该在x86中构建 - java.lang.UnsatisfiedLinkError: dlopen failed 64-bit instead of 32-bit while .so should be built in x86 Apex数据加载器 - 错误java.lang.UnsatisfiedLinkError:无法在64位JVM上加载32位SW T库 - Apex Data loader - Error java.lang.UnsatisfiedLinkError: Cannot load 32-bit SW T libraries on 64-bit JVM java.lang.UnsatisfiedLinkError:无法在Windows x86机器上的32位JVM上加载64位SWT库 - java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM in Windows x86 machine tomcat 5 java.lang.UnsatisfiedLinkError: tomcat\\apache-tomcat-5.5.36\\bin\\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform - tomcat 5 java.lang.UnsatisfiedLinkError: tomcat\apache-tomcat-5.5.36\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform 在64位CENTOS上安装32位Java:错误Java / lang / Object - Installing 32-bit Java on 64-bit CENTOS: error java/lang/Object 在Java 32位和Java 64位之间切换 - Switch between Java 32-bit and Java 64-bit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM