SWT/JFace quick start (1 min)

I was asked in my previous blog entry how to add SWT to a project classpath in order to run a simple snippet.
This for me the quickest way to run a SWT snippet from scratch :

Start Eclipse
swt-quickstart-1.png

Create a new plugin project
swt-quickstart-2.png
swt-quickstart-3.png
swt-quickstart-4.png

Go through the plugin wizard
swt-quickstart-5.png
swt-quickstart-6.png

Do not use templates
swt-quickstart-7.png
swt-quickstart-8.png
swt-quickstart-9.png

Add SWT dependency
swt-quickstart-10.png
swt-quickstart-11.png
swt-quickstart-12.png
swt-quickstart-13.png

Create a new class

Note : If you want to run a SWT snippet you even don’t need these steps. Just copy the snippet content and paste it in the package view. This will create the java class in the right package, ready to be launched. Then jump to the “run snippet” step.

swt-quickstart-14.png
swt-quickstart-15.png
swt-quickstart-16.png

Paste the snippet
swt-quickstart-17.png

Organize imports
swt-quickstart-18.png
swt-quickstart-19.png

Run the snippet
swt-quickstart-21.png

And voila
swt-quickstart-22.png

Once you got this working, you can start working with JFace or RCP, by adding the corresponding dependency.




  • This would save 5-6 screenshots. Nice.
  • You can skip one step: You don't need to create the class. Just copy the Java source code into the clipboard, select the project and paste. Eclipse will create the class file for you (with the right name and path if it has a package and class name in the code you paste).
  • boris
    Thanks a lot Nicolas!
    This is really system way to solve the problem!!

    My “non system solution”, which I use in my school lessons is as follow:
    1)Unzip swt-3.3-win32-win32-x86.zip
    2)Copy swt.jar and swt-debug.jar in C:\Program Files\Java\jre1.5.0_12\lib\ext\
    3)Create a new Java project
    4)Create a new class
    5)Paste a snippet
    6)Run Java Application

    The advantage of this is “minimal set of action” needed to be done by pupils.
    Boris Starchev – Teacher Bulgaria
blog comments powered by Disqus