|Re: How to build Windows 7/64-bit SWT apps [message #774318 is a reply to message #769300]
||Tue, 03 January 2012 17:27
| Grant Gayed
Registered: July 2009
The bitness of the jvm and of the swt being used must match because the |
jvm will refuse to load swt's native libraries otherwise. SWT verifies
this the first time that a library load is requested so that if this is
not satisfied then a meaningful error message is output (the one you're
seeing) rather than the more generic java.lang.UnsatisfiedLinkError that
So if you want to have a single download that can be run with either a
32- or 64-bit jvm then you need to ship both 32- and 64-bit swt jars,
and determine at runtime which of them to load. Java's "os.arch" system
property can be used to determine this, as its value reflects the
bitness of the jvm, not of the OS (so it will answer something like
"i386" or "i686" when using a 32-bit jre on a 64-bit OS, which is what
you're interested in).
On 12/21/2011 1:55 PM, Bill wrote:
> Thanks everyone who has tried to help. Below I will explain the many
> failed attempts to fix this and ask again for any help.
> For anyone else having this problem, the following links may be helpful:
> 1. Trying to create stand alone SWT/JFace app.
> 2. Totally don't care if it's 32, 64 or 179.3 bits.
> 3. In Windows/Preferences/Java/Installed JREs, have tried selecting both
> 32 bit and 64 bit JRE's. Have downloaded and installed others.
> 4. Out of desperation, may go and install a different version of Eclipse
> (and probably break countless other projects).
> 5. We always get the message:
> java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on
> 32-bit JVM
> I've heard a few things now, so maybe these questions will shed light:
> 1. When launching an app from Eclipse, simply editing the settings in
> "Window/Prefs/Java/Installed JREs" should allow us to launch an app with
> either a 32-bit JRE or a 64-bit JRE regardless of what version of
> Eclipse I am running. True?
> 2. Some say you need to have both the 32-bit and 64-bit versions of the
> jar file. What's with that? Given that SWT is a wrapper around native
> controls, why would anyone want to complicate things further? I can't
> believe this.
|Re: How to build Windows 7/64-bit SWT apps [message #885695 is a reply to message #768790]
||Wed, 13 June 2012 12:55
| Tom Silverman
Registered: June 2012
I was teaching 'Eclipse Plugins' the other day to a class of developers who were all working on Windows 7 64 bit OS's. Some installed the course provided Helios RCP 32 bits IDE and some were working with their usual Indigo JavaEE IDE 64 bits. |
We were exercising stand alone SWT applications. The only solution that actually worked for those who were using the Helios 32 bits to avoid the 'Could not load SWT library' problem was to install a 32 bits JDK. They had to reconfigure the IDE installed JRE (through the IDE preferences) to actually point to the 32 bits JDK. We did not try the -d32 JVM argument yet on a 64 bits version JVM.
BTW: The %JAVA_HOME% environment variable is, in my opinion, totally irrelevant in newer versions of Windows in this context. It seems Windows obtains the information from the registry and not from the environment variable and when you issue the 'java -version' command in a console you will always get the version that was installed with Windows installer regardless of the JAVA_HOME environment variable.
[Updated on: Wed, 13 June 2012 13:00]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01866 seconds