The document is structured so that you only need to read up to the point that you require, with advanced topics at the bottom.

The SWT windows port is based on the Win32 api.

The natives are compiled via an ant build.xml script with the Microsoft Visual Studio (2017) C++ compiler.

Development overview

SWT is made up of 2 parts, Java and the natives (written in C).

  • Java Part
    If you only make changes in the Java part or need to configure SWT for running snippets, then you don't need to recompile the natives, instead, you can just use the pre-compiled libraries in the binary repository.

  • Natives Part
    (Make sure the binary project for your platform is imported and open in your workspace).

Configure workspace to run snippets.

(Advanced) Building Natives.

Building just 64bit natives with no Webkit

(Last tested on Win10 64 bit & Java 11. May 2019):

You need to install the following on your system:

Building and Testing locally

In the binary git repo, in the windows project, you can build the natives via the build.xml. To do so:

  • In Eclipse, in the binary project org.eclipse.swt.win32.win32.x86_64, right click on build.xml:
  • Run As -> Ant Build ...
  • On the Targets tab check the build_libraries target (it should be the only one check for just the natives).
  • On the JRE tab select “Run in the same JRE as the workspace”
  • On the Refresh tab check “Refresh resources upon completion” to refresh your workspace after running the build; this ensures that Eclipse will pick up the fresh binaries
  • Press the “Run” button to begin.
  • If compile fails, inspect build log for warnings, they can point out issues in your configuration.

To test if you binaries actually get used, you could try to checkout an older binary repo commit with old bindings. Then try to run a snippet and get the ‘missing natives’ error. Then if you build the natives and the snippet(s) work, it shows that you've build them successfully.

Optional additional configuration

(More advanced) (Optional) Building Webkit

Note, I.E is the default backend. But Webkit is also a possible alternative Browser backend.


Note Webkit SDKs are an older version being consumed by SWT native build process and Webkit build binaries are no more available for download in public Webkit download page (https://webkit.org/downloads/)

But WebKit-r72896 sources are still avilable for download via either of: https://builds-nightly.webkit.org/files/trunk/src/WebKit-r72896.tar.bz2

Webkit SDKs:


  • Create an SWT Build dir such as C:\SWT_BUILD_DIR
  • In your enviornment:
  • Unzip two Webkit SDks into:
    • SWT_BUILD_DIR\Webkit\r72896
    • SWT_BLUID_DIR\Webkit\SupportLibrary
    • (Note: SWT's Webkit support exists for SWT 32bit on Windows, so Webkit SDKs are consumed only by the SWT 32bit build process)

Custom Java paths and 32 bit builds

You can specify a specific java sdk via:

To do a 32 bit build, install a 32bit java & specify it's path or put it into: SWT_BUILD_DIR\Java\Oracle\jdk1.8.0-latest\x86

For building windows native build for 32bit, you need to convert the source to 32bit first, by running ‘replace.64.to.32’ target.
Once sources are converted to 32bit you can run the ‘build_libraries’ target for ${workspace_loc:/org.eclipse.swt.win32.win32.x86/build.xml}


(Optional for local setup)
Now you can point the Windows hudson job to this machine and trigger a native build.
Note: For testing purpose from hudson, temporarily turn the nativeChanges flag to ‘true’ to force a native build compilation.


[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=526802