SWT on Windows 64-bit

2020-01-31 02:23发布

问题:

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?

回答1:

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!



回答2:

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.



回答3:

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



回答4:

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:

  • Go to: http://www.eclipse.org/swt/

  • Scroll down to Releases

  • Click on more at:

Stable

Windows, Linux, OS X, more...

  • In new page that opens just download this file (at the time of writing this post URL is ( http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/#SWT )

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.



回答5:

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.



回答6:

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.