Eclipse - Standard Widget Toolkit (SWT) - Installation

SWT, the Standard Widget Toolkit, will help us to draw windows for the Java platform.

On this webpage you will find links to download last stable releases http://www.eclipse.org/swt/

Once downloaded, open Eclipse, right click on the Explorer tab, then : Import... > General > Existing Projects into Workspace.
Click Next then select the Select archive file option and browse until, for example for Windows OS, your  swt-3.7.1-win32-win32-x86.zip file.

Click Finish.

Now in your Package Explorer you can see the org.eclipse.swt project.

Right click in this Explorer to create a new Java project named for example project1.

Right click on project1 > Build Path > Configure Build Path > Java Build Path.
On the right there are several tabs.
Select Projects and click Add...
Select org.eclipse.swt and click OK.

You project project1 is now linked with SWT and you can use its classes.

laugh

Comments

Comment: 

Thank You Mi-K !!!

HelloWorldSWT  which is the 1st example of SWT given after the installation of Eclipse does not work on Windows (I just tested it on Seven).

Yypically you get those errors:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
    no swt-win32-3738 in java.library.path
    no swt-win32 in java.library.path
    Can't load library: C:\Users\<YourUserName>\.swt\lib\win32\x86\swt-win32-3738.dll
    Can't load library: C:\Users\<YourUserName>\.swt\lib\win32\x86\swt-win32.dll

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
    at org.eclipse.swt.internal.C.<clinit>(C.java:21)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
    at HelloWorldSWT.main(HelloWorldSWT.java:13)

After  the download  of swt-3.7.1-win32-win32-x86.zip and by following the above given explanations by Mi-K, it just works.

By the way  you can find swt-3.7.1-win32-win32-x86.zip for example here:

http://eclipse.ialto.com/eclipse/downloads/drops/R-3.7.1-201109091335/

 

Comment: 

Yes, this fix worked for me as well. Thanks for that!

Comment: 

They should add this step to the tutorial  :-D

Comment: 

Yes this does work - in my eclipse you have to right click on your project and select "Properties" and then navigate to the build path screen.

Thank you!

Comment: 

Thank you so much, these steps fix my problem.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Type the characters you see in this picture.
Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.