Java loading library windows 7 64bit - java

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.

Related

Generating 32 Bit dll JNI

Hello im trying to use in a Project a dll generated with JNI.
i generated a 64 Bit dll but my project says %1 is not a valid win32 application
So i decided to generate a new DLL, but this time 32 Bit. I changed the Settings in my Visual Studio like i found i other posts, Configuration to Win32 and Target Machine to MachineX86.
this all works fine but when i try to launch the project with this DLL i get the same error. I checked the DLL with Dependency Walker and found out the DLL is 32Bit, but the included DLL's are 64 Bit.
So you guys are my last hope. Do you have any ideas ?
Notes: i can't change to Linux atm.
Visual Studio 2012
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
just read it but i already found my error, the problem was that eclipses changes it's installed JRE's when you switch workspace.
so in my testprogramm where i developed my 64bit libary worked. but not in the real project, where the installed JRE was a different one.
so if anyone has the same problem don't forget to check this
Please check your system PATH. Windows will attempt to load the first DLL it finds that matches the DLL's name. Windows doesn't check if the DLL is 32 or 64-bit, it will attempt to load it.
If you built a 32-bit DLL, then you're responsible for making sure that any dependent DLL is also 32-bit, and that Windows finds those 32-bit DLL's first.

JVM 32 bit installed in the Win7 64 bit Os, but it is not recognized

I have my toolchain compiled for the JVM-32 bit. And I upgraded my Os to Win7 and now the toolchain is dosen't work anymore Throws the error "java.lang.UnsatisfiedLinkError: C:....bin\libgcc_sjlj_1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform".
I had my Java 64 bit installed and through cmd "java -version" I could see the Java version. Then I uninstalled the JVM- 64 bit and then installed the 32-bit JVM, the cmd says, "Java is unrecognised program", well I have restarted my though. how can this be tackled?
Make sure that the environment variable JAVA_HOME leads to your JDM installation directory and that $JAVA_HOME\bin has been added to your PATH env variable
This should fix the problem

JNA using 32 bit dll on Win7 64 bit machine

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.

Java loadLibrary() cannot locate library after switching from 64 bit jdk to 32 bit

I am attempting to load a native library which accordingly loads an original dll. However on another computer running XP 32bit, it works fine. When executed on a win7 64 bit system it would fail to load. On the xp machine, the dll files could be in same directory as class files, however in order to not get a unsatisfied link error, i had to copy the files into the system32 folder. Then it gave an error stating that a 32bit dll cannot be loaded on a 64 bit process. I downloaded the 32 bit jdk and set the jdk in the project to load the 32 bit jdk. When that was complete i again got an Unsatisfied link error, and the files are still in system32 as well as next to the class files. I am confused as to why it would find the library when using 64 bit jdk and will not in 32 bit jdk.
...
static {
System.loadLibrary("K8055jni");
}
Exception in thread "main" java.lang.UnsatisfiedLinkError: no K8055jni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at K8055jni.<clinit>(K8055jni.java:50)
at Test.main(Test.java:4)
How do i get the 32 bit jdk to locate the same files?
IF I understand your question and problem correctly, then you might try either of:
Windows 7 place your 32-bit DLLs into \Windows\SysWOW64 instead of \Windows\System32. Oddly enough, under Win 7, System32 is for 64-bit binaries only. See this and this for details.
Better still, place your binary files in an application folder, and specify on the java command line:
-Djava.library.path=<path-to-dll-lib>

JOGL 32 vs. 64 bit libraries error

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).

Categories