40

My application throws the exception below.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SW T libraries on 64-bit JVM.

How to solve this? What is the name of jar file needed?

heavyd
  • 17,303
  • 5
  • 56
  • 74
Palani
  • 1,891
  • 7
  • 31
  • 42

6 Answers6

43

On 64-bit JVM's you need the 64-bit SWT. Current versions can be downloaded here:

http://archive.eclipse.org/eclipse/downloads/drops/R-3.6.1-201009090800/index.php#SWT

Note the first two downloads, the first is for x32, the other for x64.

Note: Even on 64bit Windows, if you use the 32bit JVM, you still need the 32bit SWT version!

BadSkillz
  • 1,993
  • 19
  • 37
Daniel
  • 27,718
  • 20
  • 89
  • 133
  • 3
    This is correct, but just a quick note that if you don't have control over which SWT gets used (e.g. developing a plug-in on a 64-bit system with your 64-bit JVM for a 32-bit RCP application), you should just install & use a 32-bit JVM to launch your product instead of modifying your RCP target platform (see Mario Marinato's answer). – Caspar Aug 04 '11 at 02:03
  • 2
    New version of : [64-bit SWT](http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.2.1-201209141800/swt-4.2.1-win32-win32-x86_64.zip) – Adil Jan 14 '13 at 12:24
  • 2
    The 64 bit SWT is pretty well hidden. I had to look very carefully before I find it. Basically, under 'Releases' on http://www.eclipse.org/swt , click 'More', and look for 'Windows (x86_64)' – Ali Oct 14 '13 at 20:53
7

I faced the same problems a couple of weeks ago. We develop an RCP application that must use 32bit SWT, but we work on 64bit machines.

What we had to do was to change Eclipse's configurations so it pointed to a 32bit JVM. We did it on Window -> Preferences -> Java -> Installed JRE's. On this preference page, we changed all references from "Program Files" to "Program Files (x86)".

I hope it helps you somehow.

Mario Marinato
  • 4,561
  • 3
  • 29
  • 49
  • If you are developing a 32-bit RCP application within a 64-bit version of Eclipse, you also have to configure the target platform of the application to explicitly use the x86 architecture. Otherwise Eclipse PDE will still set the 64-bit versions of the SWT libraries as plugin dependencies. – Henno Vermeulen Aug 10 '15 at 14:21
2

My answer is more less compilation of above posted answers, especially the comment of the user @ClickUpvote who provided (by my opinion) the best answer. So here it is, I tested it just before posting it:

If your application throws the exception below (On Windows 7 64 bit, with JVM 64)

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SW T libraries on 64-bit JVM.

Then the solution is as follows: On 64-bit JVM's you need the 64-bit SWT.

Current versions can be downloaded as described below - pretty well hidden:

Stable

Windows, Linux, OS X, more...

Windows (x86_64) (Supported Versions) (http) 6.3 MB swt-4.4-win32-win32-x86_64.zip

And that is exactly the version you need.

Nenad Bulatović
  • 7,238
  • 14
  • 83
  • 113
2

For the latest link to SWT library downloads: SWT project page

Ravenwater
  • 735
  • 1
  • 5
  • 14
1

Those links are all a little out of date for downloads of the 64-bit versions. Try this one: http://jarfiles.pandaidea.com/swt.html, found after an hour of googling.

Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106
1

You're simply building against the wrong version of SWT. Either download the 64bit Eclipse or grab the delta pack and build against the correct target environment.

andyczerwonka
  • 4,230
  • 5
  • 34
  • 57
  • What is the "delta pack"? I'm curious about a generic solution, because I would love to make my SWT application dynamically select the correct jar. Also, you should bear in mind that SWT needs to be the same version as your virtual machine -- not necessarily as your O/S. – Paul Lammertsma May 30 '10 at 14:59
  • The delta pack will not let you do anything 'dynamic', it just gives you the ability to build for any target from any target. http://louismrose.wordpress.com/2009/01/23/installing-the-rcp-delta-pack-for-eclipse/ – andyczerwonka May 31 '10 at 04:49