Download Details |
These drops contain the SWT libraries and source for standalone SWT application development. For examples of standalone SWT applications refer to the snippets section of the SWT Component page.
To run a standalone SWT application, add the swt jar(s) to the classpath and add the directory/folder for the SWT JNI library to the java.library.path. For example, if you extract the download below to C:\SWT you would launch the HelloWorld application with the following command:
java -classpath C:\SWT\swt.jar;C:\MyApp\helloworld.jar -Djava.library.path=C:\SWT HelloWorld
Note that if you are running on Eclipse 3.3 or later, you do not need to specify the library path, so you would launch the HelloWorld application with the following command:
java -classpath C:\SWT\swt.jar;C:\MyApp\helloworld.jar HelloWorld
To run the standalone SWT examples that are shipped with Eclipse, download them from here. Then copy the file eclipse\plugins\org.eclipse.swt.examples_xxx\swtexamples.jar to C:\SWT. Now you can run the examples that are described here. For example:
cd C:\SWT
java -classpath swt.jar;swtexamples.jar
org.eclipse.swt.examples.controlexample.ControlExample
On Linux systems, note that the classpath separator character is a colon, so the equivalent command becomes:
java -classpath swt.jar:swtexamples.jar org.eclipse.swt.examples.controlexample.ControlExample