I am trying to use SVMLight from Java, using the JNI wrapper on this page :
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
Can I solve this by recompiling the .dll for 64 bit? How would I go about doing this? Is there some other workaround I can use? SVMLight makes the C source code available.
Yes, you'll have to recompile the DLL for 64-bit. 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.
I had the same issue with a Java application using tibco dll originally intended to run on Win XP. To get it to work on Windows 7, I made the application point to 32-bit 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.
Final note: that call to System.loadLibrary is silly. Either call System.load with a full pathname or let it search java.library.path.
Had same issue in win64bit and JVM 64bit
Was solved by uploading dll to system32
Be sure you are setting PATH to Program Files (x86) not Program Files . That solved my problem.
Got this from - 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.
Field fieldSysPath;
fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" );
fieldSysPath.setAccessible( true );
fieldSysPath.set( null, null );
Go to
Project properties >> Run >> VM options
and put this address:
-Djava.library.path="C:\opencv\build\java\x64"
Just go to install download jdk_x86 and it install in Program Files (x86) and set the jre path in your project. Thats it.
I had a problem when run red5(tomcat) on Windows x64 that previous worked under Windows x32, got next error:
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
"Environment variables"
"User variables for Home"
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;..
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. 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; it simply lets you use the 32-bit JVM
for the program with the 32-bit DLL
.
For the compilation, it shouldn't matter which javac
gets used - 32-bit or 64-bit.
>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
I'll post a code example for Windows
, since that seems to be the OS used by the 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
. 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
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.
for example:- you might have selected this (C:\\opencv\\build\\java\\x64).
instead you select this for native library(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
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. At least this fixed problem I had.
no build for Win64 necessary.
Download 64x version on https://tomcat.apache.org/download-native.cgi
from one of the mirrors ie
from zip use:
bin\\x64\\tcnative-1.dll
我遇到了同样的问题,@Daniel Pryden 是对的,我都尝试过,并且转移到 32 位 JVM 对我有用
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.