There are several steps required to run the SWT standalone examples manually.
Create a Java Project to contain the examples. Call it SWT Examples.
Make sure the swt.jar file is on the java classpath, by doing the following:
Select the SWT Examples Project and bring up the Properties dialog.
On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select swt.jar.
Next, click on the Attach Source button, then click on the Browse File System button and select swtsrc.zip.
The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
Make sure the swtexamples.jar is on the java classpath, by doing the following:
Select the SWT Examples Project and bring up the Properties dialog.
On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select swtexamples.jar.
Next, click on the Attach Source button, then click on the Browse File System button and select swtexamplessrc.zip.
The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
Make sure that referenced libraries are visible in the Packages view, by doing the following:
In the Packages view of the Java Perspective, drop down the View menu.
Ensure that Show Referenced Libraries is checked.
Make sure the SWT runtime library is in the library search path, by doing the following:
In the Packages view of the Java Perspective, expand swtexamples.jar.
You will see all of the packages and other resource files present in the jar file, including the executable class for each example.
Select the executable class (the one containing the main() method) for the particular example that you wish to run and bring up the Properties dialog.
On the Execution Arguments page, select the VM arguments field and enter -Djava.library.path=<runtime-library-path>.
The runtime library path is the following directory, depending one which Operating System you are using to run Eclipse:
In the Packages view of the Java Perspective, expand swtexamples.jar. You will see all of the packages and other resource files present in the jar file, including the executable class for each example.
All of the standalone SWT examples are intended to be run as Java Applications. No parameters need be passed to any of these examples, other than any required VM arguments. To run an example, simply select the executable class for the particular example, then click the Run button on the toolbar.
Consult the documentation of each individual example for the names of its executable class(es) and additional details.
swtexamples.jar
contains the following examples: