[英]Can't load IA 32-bit .dll on a AMD 64-bit platform
I am trying to use SVMLight from Java, using the JNI wrapper on this page :我正在尝试使用 Java 中的SVMLight ,使用此页面上的JNI 包装器:
static {
System.loadLibrary("lib/JNI_SVM-light-6.01/lib/svmlight");
}
I get the following error:我收到以下错误:
... lib\\JNI_SVM-light-6.01\\lib\\svmlight.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform ... lib\\JNI_SVM-light-6.01\\lib\\svmlight.dll:无法在 AMD 64 位平台上加载 IA 32 位 .dll
Can I solve this by recompiling the .dll for 64 bit?我可以通过重新编译 64 位的 .dll 来解决这个问题吗? How would I go about doing this?我该怎么做呢? Is there some other workaround I can use?我可以使用其他一些解决方法吗? SVMLight makes the C source code available. SVMLight 使 C 源代码可用。
Yes, you'll have to recompile the DLL for 64-bit.是的,您必须为 64 位重新编译 DLL。 Your only other option is to switch to a 32-bit JVM, or otherwise get some 32-bit process to load the DLL on your behalf and communicate with that process somehow.您唯一的其他选择是切换到 32 位 JVM,或者让一些 32 位进程代表您加载 DLL 并以某种方式与该进程通信。
I had the same issue with a Java application using tibco dll originally intended to run on Win XP.我在使用最初打算在 Win XP 上运行的 tibco dll 的 Java 应用程序中遇到了同样的问题。 To get it to work on Windows 7, I made the application point to 32-bit JRE.为了让它在 Windows 7 上运行,我将应用程序指向 32 位 JRE。 Waiting to see if there is another solution.等待看看是否有其他解决方案。
Short answer to first question: yes.第一个问题的简短回答:是的。
Longer answer: maybe;更长的答案:也许; it depends on whether the build process for SVMLight behaves itself on 64-bit windows.这取决于 SVMLight 的构建过程是否在 64 位 Windows 上运行。
Final note: that call to System.loadLibrary is silly.最后一点:对 System.loadLibrary 的调用是愚蠢的。 Either call System.load with a full pathname or let it search java.library.path.要么使用完整路径名调用 System.load,要么让它搜索 java.library.path。
Had same issue in win64bit and JVM 64bit在 win64bit 和 JVM 64bit 中有同样的问题
Was solved by uploading dll to system32已通过将dll上传到system32解决
Be sure you are setting PATH to Program Files (x86) not Program Files .确保您将 PATH 设置为Program Files (x86)而不是Program Files 。 That solved my problem.那解决了我的问题。
Got this from - http://blog.cedarsoft.com/2010/11/setting-java-library-path-programmatically/来自 - http://blog.cedarsoft.com/2010/11/setting-java-library-path-programmatically/
If set the java.library.path, need to have the following lines in order to work.如果设置java.library.path,需要有以下几行才能工作。
Field fieldSysPath;
fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" );
fieldSysPath.setAccessible( true );
fieldSysPath.set( null, null );
Go to去
Project properties >> Run >> VM options项目属性 >> 运行 >> VM 选项
and put this address:并把这个地址:
-Djava.library.path="C:\opencv\build\java\x64"
I had a problem when run red5(tomcat) on Windows x64 that previous worked under Windows x32, got next error:在以前在 Windows x32 下运行的 Windows x64 上运行 red5(tomcat) 时遇到问题,出现下一个错误:
INFO pool-15-thread-1 com.home.launcher.CommandLauncher - Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\....\lib\Data Samolet.dll: Can't find dependent libraries
INFO pool-15-thread-1 com.home.launcher.CommandLauncher - at java.lang.ClassLoader$NativeLibrary.load(Native Method)
Problem solved when I installed Java x32 version and set next当我安装 Java x32 版本并设置 next 时问题解决了
"Environment variables" “环境变量”
"User variables for Home" “家庭用户变量”
JAVA_HOME => C:\\Program Files (x86)\\Java\\jdk.1.6.0_45 JAVA_HOME => C:\\Program Files (x86)\\Java\\jdk.1.6.0_45
"System variables" “系统变量”
Path[at the beginning] => C:\\Program Files\\Java\\jdk.1.8.0_60;..路径[开头] => C:\\Program Files\\Java\\jdk.1.8.0_60;...
I had an issue related to this and was reading我有一个与此相关的问题,正在阅读
"Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\opencv\build\java\x86\opencv_java2413.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform "
and it took me an entire night to figure out.我花了整晚才弄明白。
I solved my problem by copying the dll in C:\\opencv\\build\\java\\x64
to my system32 folder.我通过将C:\\opencv\\build\\java\\x64
的 dll 复制到我的 system32 文件夹解决了我的问题。 I hope this will be of help to someone.我希望这会对某人有所帮助。
Here is an answer for those who compile from the command line/Command Prompt.这是从命令行/命令提示符编译的人的答案。 It doesn't require changing your Path
environment variable;它不需要更改您的Path
环境变量; it simply lets you use the 32-bit JVM
for the program with the 32-bit DLL
.它只是让您将 32 位JVM
用于带有 32 位DLL
。
For the compilation, it shouldn't matter which javac
gets used - 32-bit or 64-bit.对于编译,使用哪个javac
无关紧要 - 32 位或 64 位。
>javac MyProgramWith32BitNativeLib.java
For the actual execution of the program, it is important to specify the path to the 32-bit version of java.exe
对于程序的实际执行,指定java.exe
32位版本的路径很重要
I'll post a code example for Windows
, since that seems to be the OS used by the OP.我将为Windows
发布一个代码示例,因为这似乎是 OP 使用的操作系统。
Windows视窗
Most likely, the code will be something like:最有可能的代码类似于:
>"C:\Program Files (x86)\Java\jre#.#.#_###\bin\java.exe" MyProgramWith32BitNativeLib
The difference will be in the numbers after jre
.不同之处在于jre
之后的数字。 To find which numbers you should use, enter:要查找您应该使用的数字,请输入:
>dir "C:\Program Files (x86)\Java\"
On my machine, the process is as follows在我的机器上,过程如下
C:\Users\me\MyProject>dir "C:\Program Files (x86)\Java"
Volume in drive C is Windows
Volume Serial Number is 0000-9999
Directory of C:\Program Files (x86)\Java
11/03/2016 09:07 PM <DIR> .
11/03/2016 09:07 PM <DIR> ..
11/03/2016 09:07 PM <DIR> jre1.8.0_111
0 File(s) 0 bytes
3 Dir(s) 107,641,901,056 bytes free
C:\Users\me\MyProject>
So I know that my numbers are 1.8.0_111
, and my command is所以我知道我的数字是1.8.0_111
,我的命令是
C:\Users\me\MyProject>"C:\Program Files (x86)\Java\jre1.8.0_111\bin\java.exe" MyProgramWith32BitNativeLib
Don't worry about you should just change .dll from x64 to x86, in the native library.不用担心,您应该将本机库中的 .dll 从 x64 更改为 x86。
for example:- you might have selected this (C:\\opencv\\build\\java\\x64).例如:- 您可能选择了这个 (C:\\opencv\\build\\java\\x64)。
instead you select this for native library(C:\\opencv\\build\\java\\x86).相反,您为本机库(C:\\opencv\\build\\java\\x86)选择了这个。
My windows laptop has both the clients 32 & 64 bit I started facing all of sudden then I reordered the path variable like below我的 Windows 笔记本电脑同时拥有 32 位和 64 位客户端,我突然开始面对,然后我重新排序了路径变量,如下所示
Before:前:
C:\app\oracle64\product\12.1.0\client_1\bin;
C:\app\oracle32\product\12.1.0\client_1\bin;
After:后:
C:\app\oracle32\product\12.1.0\client_1\bin;
C:\app\oracle64\product\12.1.0\client_1\bin;
started working... Hope this helps everyone.开始工作...希望这对大家有帮助。
For your Native library location, use X64 over X86.对于您的本机库位置,请使用 X64 而不是 X86。 At least this fixed problem I had.至少我遇到了这个固定的问题。
no build for Win64 necessary.不需要为 Win64 构建。
Download 64x version on https://tomcat.apache.org/download-native.cgi在https://tomcat.apache.org/download-native.cgi上下载 64x 版本
from one of the mirrors ie从其中一个镜子,即
https://mirror.checkdomain.de/apache/tomcat/tomcat-connectors/native/1.2.28/binaries/tomcat-native-1.2.28-openssl-1.1.1k-win32-bin.zip https://mirror.checkdomain.de/apache/tomcat/tomcat-connectors/native/1.2.28/binaries/tomcat-native-1.2.28-openssl-1.1.1k-win32-bin.zip
from zip use:从 zip 使用:
bin\\x64\\tcnative-1.dll bin\\x64\\tcnative-1.dll
我遇到了同样的问题,@Daniel Pryden 是对的,我都尝试过,并且转移到 32 位 JVM 对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.