Skip to main content
Jump to: navigation, search


Creating an executable JAR file for a stand-alone SWT program is very similar to creating any executable JAR file, with one important difference. Starting with Eclipse version 3.3, the file "swt.jar" file includes platform-specific executable files that are unpacked automatically when your SWT program is executed. This means that a given runtime folder will normally be platform specific.

The detailed instructions for creating an executable JAR file for a stand-alone SWT file are listed below.

  1. Create a runtime folder for the desired runtime target on your system (e.g., c:\swt\runtime-linux). Note that the target platform does not need to be the same as your development platform.
  2. Find the correct SWT JAR file for the desired target platform. You can download the desired ZIP file from the SWT website. For example, for Eclipse 3.3 and a target platform of Linux, download the file Expand this ZIP file and copy the swt.jar file to the runtime folder. Remember that this swt.jar file is specific to one platform, in this case Linux.
    Manifest-Version: 1.0
    Class-Path: swt.jar 
    Main-Class: mypackage.MyClassWithMainMethod
    (blank line at end of file)
  4. Make sure the manifest file ends with a blank line. Put the name of your package and class that contains the main() method for the Main-Class.
  11. If needed (i.e., your target platform is different than your development platform), copy the runtime directory to a directory on your target platform.

Troubleshooting Errors


  1. The swt.jar file name is missing or misspelled in the mainfest file.
  2. The swt.jar file is missing from the runtime folder.

See Also:

Back to the top