I have 64bit Windows, 64 bit eclipse and both 32 and 64 bit jre installed.
What I want to do: I have some 32bit process, to which I want to attach a GUI made in e4. My eclipse is fully configured (not by me) for 64bit development and it is critical not to reconfigure it as much as possible (there is like a standard build, widely used in firma).
Now, let's assume I create a dummy eclipse 4 RCP project, which of course uses SWT libraries. If I run it on 32 bit jre, I will receive an error: "can't load a 64 bit SWT libraries on 32 bit jvm". Fully expectable.
Now the question. I've downloaded 32 bit SWT libraries, the swt-4.9-win32-win32-x86.zip file contains swt.jar and src.zip. I have obviously 64 bit STW libraries in eclipse plugins folder. What exactly, step-by-step, I need to do in my plugin project in order to run it on 32 bit jre? Sorry, I'm a bit newbie in plugin development in eclipse and I don't know how to "simply replace 64 bit versions with 32 bit ones".
P.S the variant "just run everything on 64 bit jvm" is impossible, since this process loads 32bit native libs.
I am developing a windows application.
I need to create an installer(a common installer for both 32 bit and 64 bit windows OS) for that, for that I am using Install4J software.
I developed in Windows 32 bit, jdk 1.7.
Installer working fine in 32 bit windows os, but when I try to create installer in win 64 bit os, it is throwing me an error like java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
Please help to sort out this..
The problem is that there are separate "swt.jar" files for 32bit and 64bit Windows JVMs, and they are not interchangeable. You can't use the 32bit Windows JAR on a 64bit Windows JVM ... or the other way around. (AFAIK, the fundamental impediment is in Windows and the JVM rather than SWT.)
One possibility is to do some classloader tricks, and dynamically choose between different JARs depending on the platform that your app detects at runtime. The installer would need incorporate both flavours of the SWT JAR ... with different names.
This answer goes into more detail: Supporting SWT on Windows/Mac & 32bit/64bit
Well that is just because when u install program into the Program files that will install only 32-but and will load 32-bit libraries so u can do one thing very simple solution of that just install your program in the the Program files x86 if u have 64 bit system.
that work for me and might work for u too.
so the questions as in the title, I need to run my server application in Tomcat on a System which is 32 bit Windows XP, I am working and compiling on my 64 bit Windows 7 in Eclipse. How do I compile it to 32 bit, what do I need to do? I assume it won't work on the 32 bit Windows when I'm compiling it on a 64 bit machine?
Java doesn't build 32-bit or 64-bit applications - bytecode is portable across different bit architectures.
The only exception is native libraries that you might be using in your code. If there are any then you will have to manually compile those for the respective platform. Otherwise the java code is totally portable across 32-bit and 64-bit platforms.
The problem is your JNI DLL, which needs to be compiled for 32-bit to match the 32-bit JRE.
Java is independent of the OS.
You can compile with your 64bit machine and run this on a 32bit computer as long as this computer has a 32bit VM.
If you're still searching for some "simple" solution, one would be to install a 32 bit os in a virtual machine and run eclipse from there.. Very ugly I know, but it works.
Another approach is mentioned here. How to launch java swing app which used precompled DLL from cmd?
You could install a 32bits jdk on a 64bits machine. point the JAVA_HOME to this jdk and use it. It
I'm trying to debug this problem but not sure where exactly i need to replace SWT jar file for Eclipse.
Current System Config:
Eclipse Helios 3.6 - 32 Bit
JDK 1.6
JVM - 32 Bit
Windows 7 - 64 Bit
Error Message:
java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:687)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at de.vogella.rcp.intro.first.Application.start(Application.java:18)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
An error has occurred. See the log file
Workaround:
Link1: Understood the cause of the problem and i tried to replace 64-bit SWT to 32 Bit but i'm not sure whether i'm doing it right ?
downloaded 32-bit file swt-3.6.1-win32-win32-x86.zip
Extracted the zip file
Have files as shown below
copied swt.jar file
navigated to C:\Program Files\eclipse\plugins
removed 64-bit Swt file ( i.e org.eclipse.swt.win32.win32.x86_64.source_3.6.2.v3659c )
placed copied swt.jar file and relaunched
Still throws SAME ERROR
also tried renaming the swt.jar file to org.eclipse.swt.win32.win32.x86_64.source_3.6.2.v3659c
Still same ERROR
Link2: Suggested the alternative solution but couldn't resolve the problem.
Still same ERROR
I really don't want to uninstall 32-JVM and 32-Bit Eclipse and install corresponding 64 Bit versions.
Not an OPTION
Workaround After the paulsm4 and Paul Webster response & i'm confused
When i tried executing this to check JVM, JRE version in Eclipse
package javaVersion;
public class JavaVersion
{
public static void main( String[] args )
{
System.out.println( "JRE Version :" + System.getProperty( "java.runtime.version" ) );
System.out.println( "JVM Bit size: " + System.getProperty( "sun.arch.data.model" ) );
}
}
Output:
1.6.0_31-b05
JVM Bit size: 32
However when i tried on command line for JAVA - VERSION
So my understanding system has 64bit JVM where as Eclispe is reading 32 Bit JVM. So how can i divert system to read 32 Bit JVM ?
Eclipse is launching your application with whatever JRE you defined in your launch configuration. Since you're running the 32-bit Eclipse, you're running/debugging against its 32-bit SWT libraries, and you'll need to run a 32-bit JRE.
Your 64-bit JRE is, for whatever reason, your default Installed JRE.
To change this, first make sure you have a 32-bit JRE configured in the Installed JREs preference. Go to Window -> Preferences and navigate to Java -> Installed JREs:
You can click Add and navigate to your 32-bit JVM's JAVA_HOME to add it.
Then in your Run Configuration, find your Eclipse Application and make sure the Runtime JRE is set to the 32-bit JRE you just configured:
(Note the combobox that is poorly highlighted.)
Don't try replacing SWT jars, that will likely end poorly.
Well, duh :) SWT uses JNI ... and JNI is strictly platform specific.
Use 32-bit libraries with a 32-bit JVM, 64-bit libraries with a 64-bit JVM, make sure the versions match exactly, and don't mix'n'match.
IMHO...
PS:
You can have multiple JVMs and/or multiple Eclipse's co-existing on the same box.
i removed
C:\ProgramData\Oracle\Java\javapath
from my path, and it worked for me.
and make sure you include x64 JDK and JRE addresses in your path.
Just add -d32 to VM arguments in the "Edit launch configuration properties".
Thanks a lot guys!
I overlooked my ECLIPSE VERSION it was 64Bit and 3.6
I had to make sure it's 32Bit Eclipse, 32 Bit JVM so i uninstalled Eclipse & all JVM for clean start. Installed 32Bit JDK1.6 from here and 32Bit Eclipse from here
I just replaced the swt.jar in my package with the 64bit version and it worked straight away. No need to recompile the whole package, just replace the swt.jar file and make sure your application manifest includes it.
I also faced the same problem a long time ago.
Here is the Solution
In Eclipse Click on "Windows"-->"Preferences"---->"Java"---> "Installed JREs"---->Select the JDK, click on "Edit".
Check your JDK path, is it according to your path in environmental variables defined in system.
if not then change it to "path" defined directory.
Check the target definition if you are working with an RCP-SWT project.
Open the target editor of and navigate to the environent definition. There you can set the architecture. The idea is that by starting up your RCP application then only the 32 bit SWT libraries/bundles will be loaded. If you have already a runtime configuration it is advisable to create a new one as well.
I removed C:\ProgramData\Oracle\Java\javapath from my path, and it worked for me.
But make sure you include x64 JDK and JRE addresses in your path.
So , just make sure that you are on the right environment
i.e 32 bit SWT LIBRARIES should match 32 bit JVM , vice versa.
I solved this problem by installing 64-bit jdk ,64-bit jre and finally by adding setting the jdk path in environment variables adn adding jre to the eclipse.
Install a JDK.
It's possible to get Eclipse to run with a JRE, or at least it used to be, but why bother? Eclipse is much happier with a JDK.
Remember that the JRE that is used to run Eclipse does not have to be the JRE that Eclipse uses to run an application.
PS. I'm assuming here that the original poster's problem was getting Eclipse to start, and not (as some other Answers seem to address) getting Eclipse to start an application.
Go to Path C:\ProgramData\Oracle\Java\javapath
(This path is in my case might be different in your case).
Rename the folder ORACLE with other name line ORACLE_OLD.
And Restart the STS/IDE .
This works for me
I removed C:\ProgramData\Oracle\Java\javapath from my path, and it worked for me.
Perfect Answer, Thanks Nikil.
I'm using Install4J mostly for it's great jar file optimization and support for pack200. The main hiccup I'm running up against is that we have several native libraries that are 32-bit only. We need to run with a 32 bit JVM for those to work, ideally dynamically downloding one and installing it when one's not there.
The case that's tricky is when there is a JVM installed above the minimum version we need, but that's 64-bit instead of 32-bit. Any way we can detect that and download and install a 32-bit JVM to run with instead?
You can bundle the 32bit JRE to installer. And instruct Install4J not to use already existing Java on user's machine but rather the one you have bundled.
I had similar problem, check Running install4j on 64bit JRE in Win.
I actually had missed the fact that Install4J already handles this. Since the launcher itself is 32 bit, Install4J requires a 32 bit JVM. So it downloads one automatically if it's not there.