I have been working in Java for past 8 months. Currently I am using JNA to load a third party DLL and it works fine on 32bit WinXP and 32bit Win7 machines.
On a 64bit Win7 machine, this third party dll is present under C:\Program Files(x86), I assume this means its a 32 bit DLL. So, here is the configuration I used so far,
Win7 machine - 64 bit,
Third party dll - 32 bit (as per above mentioned assumption),
JRE - tried with both 32bit and 64bit
But I get the following - "error: java.lang.UnsatisfiedLinkError: Unable to load library 'Wrapper': The specified module could not be found."
Please let me know if JNA supports loading a 32bit DLL, using a 32 bit JRE on a 64bit machine. Also, if this 32bit DLL has dependencies on other 32 & 64 bit DLLs would JNA still support it.
I am going to use procexp to find out if I am missing any dependencies. I will update this post accordingly.
Please provide your expert advise. Thanks in advance !
JNA does support loading 32 bit DLLs on a 64bit machine. But we need a 32 bit JVM to do this.
I was using Platform.is64Bit() to determine the path of the DLL. I learnt that this method returns the configuration of the JVM and not the OS.
So, in my case when I was using 32bit VM on 64bit machine, the path to the DLL was wrong.
Related
I have a 32 bit .dll (sqljdbc_auth.dll) and develope on a 32 bit jdk. My System is 64 Bit. It works all the time, but now i create a runnable jar file, this file can be execute. But when i started it over a Batch File (-jar %~dp0\ScheduledPerformanceanalyse.jar) it dosent work.
Warning: Faild to load the sqljdbc_auth.dll: Cant load aIA 32-bit .dll on AMD 64bit platform.
By changing the dll to a 64 bit version it works fine, but only by the batch, by my Web-Applikation it doesen't.
My Question: How can I fix the problem without changing my jdk to a 64 bit Version?
EDIT:
I found the solution, the problem was the jre 64 bit. On the working system were both jre's installed. The batch-File used the JRE 64 not the 32 bit...
Earlier this year I code Java GUI to work in Matlab environment for image acquisition purposes. I was able to call Java_Gui.jar inside the matlab, as well as to use some of the classes from the .jar file. The GUI was tested on WinXP 32bit, and Matlab2006b and Matlab 2008a. Matlab code for calling Java classes:
clc,clear all,close all
javaaddpath('C:\Users\...\JavaGUI.jar');
JavaGUI.main([]);
pause(1)
JavaGUI.main2();
However, when tried same program with Win7 on 64bit and Matlab2011a the familiar problem occurred:
??? Java exception occurred:
java.lang.UnsatisfiedLinkError: no sserial in java.library.path
Any idea why is this happening? Maybe I should compile my jar file on 64bit version?
The code is still working on 32bit Win, just checked it.
ANSWER: Works with 32-bit version of Matlab on 64-bit Windows 7!
Probably your JAR uses JNI.
JNI won't be able to load into a process of a different bitness than the DLL containing the native portions. You'd need a 64-bit version of the library (the Java code is no different, the native DLLs are) in that case.
The problem is that you are using a library in java that makes calls to a native library for which you need the 64-bit version in order to run it in the 64 bit JRE. You need to either switch to a 32 bit version of Matlab, or track down the library that makes native calls to sserial and update to the 64 bit version for 64 bit systems.
I am new to JOGL. I use Eclipse and I imported JOGL jar and dll (yes, Windows OS). But, when I was searching for JOGL libraries, I downloaded 32 bit version. I have 64 bit OS, but since I can run 32 bit apps I thought it will still be more suitable. But compiler is complaining: Can't load IA 32-bit .dll on a AMD 64-bit platform
Well, first, I thought Java itself is NOT separated by architecture. Yes, I know I am using native libraries to link into Windows OpenGL interface (API), but I just want to include these code snippets into java bytecode, so why compiler cant let me use 32 bit ones? Thanks.
Since you have a 64-bit OS, you installed the 64-bit JVM. The 64-bit JVM cannot use the 32-bit DLLs, so you'll need to either download the 64-bit ones, or alternatively, install the 32-bit JVM on your system and set Eclipse to use that JVM instead.
64bit JVM cannot load 32bit libraries. You need to start 32b JVM to make it work (or get 64b dlls).
I export try.jar file using 32 bit java libraries. On the client site, I have 64 bit java libraries. Can try.jar behave 64 bit executable?
For example, I have
Runtime rt = Runtime.getRuntime();
s = rt.exec("someExecutable");
the someExecutable binary is in 64 bit and using this code with 32 bit java libraries seems to be not working.
My soln' to this problem is to export try.jar using 32 bit java libraries (because my enviroment is in 32 bit) and run try.jar using 64 bit libraries in the client site.
Is this approach correct or any other suggestions?
when I run someExecutable directly (no java involved) which is 64 bit on the client site It works fine (client site is also 64 bit.).
But when I use s = rt.exec("someExecutable"); It doesnt work. the java libraries (jre executables downloaded over java.sun.com) are now 32 bit at both client and development sites.
Do my problem resolve if I install 64 bit libs to client site but not on development site??
Java librairies aren't the problem here. If you want to exec someExecutable, this program must be in 32 bits for a 32bit environment.
Java libraries aren't 32 or 64 bit, they are in Java ByteCode. So they can be executed on any JVM 64 or 32 the exact same way.
You will need a someExecutable binary available on the operating system architecture you wish to run your program on.
This isn't actually anything to do with Java - all Java is doing is going to the underlying operating system and trying to run the command in the String you pass to Runtime.exec().
What's the problem you get when do that?, if you're using 100% java code, JRE should transparents all other things.
I have a java webstart program, it runs on xp, osx, vista, and windows 7.
I just tried to run it on windows 7 64bit and it is having a problem loading a library.
On this win7x64 machine I have the 64bit jdk/jre and the library it is not loading is swt-win32.dll. Yeah it's 32bit, but I'm getting:
Exception in thread "Thread-10" java.lang.UnsatisfiedLinkError: no swt-win32-3325 or swt-win32 in swt.library.path, java.libary.path or the jar file...
I have tried putting the dll on the java.library.path (physically copying it to the folder) and still get the exact same error. So am I getting this error because it's a 32bit dll or because it actually just can't find it? can the 64bit jdk/jre load/use 32bit dll's or do I need to either find the 64bit version of the dll or run the 32bit jdk/jre?
You have the answer already. 64-bit DLL's require the 64-bit JDK and 32-bit DLL's require the 32-bit JDK.
swt-win32.dll is actually a SWT UI framework(eclipse) dll. Try putting it in a directory which is in your system path.
If that doesn't work, then your next best bet would be to get the SWT binaries for 64 bit windows here. I think it works for windows Vista 64. There is no mention of windows 7 but it "should" work.