Eclipse SWT A look at FWT, SWT and how to install it on 64-bit platforms.

The Fantom Widgit Toolkit (FWT) is a toolkit for building both desktop and HTML5 browser applications. FWT is a wrapper around the Standard Widget Toolkit (SWT) from Eclipse.

Part of the reason why SWT is so awesome and integrates so well into your native windows environment is because it relies on platform specific native code. This means to run FWT applications on your desktop, SWT has to be installed on your system. This also means there are a number of different SWT downloads, one for each platform. A platform being Win, Win 64-bit, Linux, Linux 64-bit, Solaris, etc... you get the picture!

Fantom comes pre-bundled with a couple of common SWT platforms, but not all of them. A couple of notable omissions are Windows 64-bit and Linux 64-bit.

Does Fantom support my platform?

An easy way to determine if the standard Fantom install supports your platform is to run a desktop application and see if it works. flux is a desktop app that comes with Fantom, so run it and see what happens:

select all
C:\> flux

sys::Err: java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Widget
  fwt::Desktop.appName (
  flux::Main.main (
  java.lang.reflect.Method.invoke (
  fan.sys.Method.invoke (
  fan.sys.Method$MethodFunc.callList (
  fan.sys.Method.callList ( ( ( ( ( (

If you see the stack trace above then you need to install SWT for your platform.

Installing SWT

Installing SWT is as simple as copying a .jar file into your Fantom home directory.

But to download the correct version of SWT you need to know which platform you have. Run the following command:

select all
C:\> fan -version

Fantom Launcher
Copyright (c) 2006-2013, Brian Frank and Andy Frank
Licensed under the Academic Free License version 3.0

Java Runtime:
  java.version:    1.6.0_45    Java HotSpot(TM) 64-Bit Server VM
  java.vm.vendor:  Sun Microsystems Inc.
  java.vm.version: 20.45-b01
  java.home:       C:\Apps\Java\jdk1.6.0_45\jre
  fan.platform:    win32-x86_64
  fan.version:     1.0.67
  fan.env:         sys::BootEnv
  fan.home:        C:\Apps\fantom-1.0.67

And make a note of the fan.platform value. As you can see, mine is win32-x86_64 (Windows 64 bit), yours may be different.

Next, download SWT for your platform. Fantom (as of v1.0.67) uses SWT v4.2.2. You can download it from the eclipse website below.

SWT v4.2.2 Downloads

Note that at time of writing, the download page linked from the SWT home page doesn't exist! So use the direct link above.

File links for some popular platforms are given below. They're also hosted on Alien-Factory should the eclipse links go dead.

From the .zip file, extract swt.jar.

This swt.jar needs to be copied into your Fantom home directory. Specifically it needs to be copied to:


where platform is the value you noted earlier. Create the directory if it does not exist.

So on my machine I would copy it to:


And now when you run flux you should see:

Flux Screenshot

Happy FWT developing!

Also see SWT Support on