英文:
One NetBeans Project can load a .dll but another throws "Can't load AMD 64-bit .dll on a IA 32-bit platform"
问题
我有两个 NetBeans 项目 - 项目 A,一个仅用于证明概念的标准 Java 应用程序,以及项目 B,我将代码复制到其中。项目 B 是一个 NetBeans IDE Framework 应用程序。项目 A 成功执行以下代码,但项目 B 抛出错误:
java.lang.UnsatisfiedLinkError: 在 IA 32 位平台上无法加载 AMD 64 位 .dll
我只有一个版本的 NetBeans,也只有一个版本的 Java JDK("1.8.0_121" 64 位)。
Path dllFilePath = Paths.get("c:\\jnetpcap.dll");
if (Files.exists(dllFilePath)) {
System.out.println(dllFilePath + " 存在!!!");
} else {
System.out.println(dllFilePath + " 不存在???");
}
System.load(dllFilePath.toString());
作为额外的难题,如果 dll 文件位于 \System32\ 中,项目 B 无法找到该文件,而项目 A 可以。
非常感谢任何建议。
英文:
I have two NetBeans projects - project A, a standard Java app that exists only to prove a concept, and project B which is a legacy app that I copied my code into. Project B is a NetBeans IDE Framework app. Project A executes the following code successfully but Project B throws the error:
java.lang.UnsatisfiedLinkError: Can't load AMD 64-bit .dll on a IA 32-bit platform
I have only one version of NetBeans and only one version of the Java JDK ("1.8.0_121" 64 bit).
Path dllFilePath = Paths.get ("c:\\jnetpcap.dll");
if (Files.exists(dllFilePath)) {
System.out.println(dllFilePath+" exists!!!");
} else {
System.out.println(dllFilePath+" doesn't exist???");
}
System.load(dllFilePath.toString())
As an additional puzzle, Project B can't find the dll if it's in \System32\ but Project A can.
Any suggestions are greatly appreciated.
专注分享java语言的经验与见解,让所有开发者获益!
评论