Supplying the SWT Package to the Java Compiler
First,
you’ve got to let javac know
where to find the SWT libraries so that it can compile your
applications.
How do I do that?
You first need to create a Java project, and then specify the Java Build Path for that project.
Note
The Java Build Path in Eclipse is the equivalent of specifying the -classpath option for the javac compiler on the command line.
The Java Build Path in Eclipse may be specified either at the time the project is created, or later by selecting Project Properties from the Eclipse menu. Either way, you will invoke a dialog similar to that shown in Figure 1-6, the Project Properties dialog. Select Java Build Path from the list on the left side of the dialog, which will reveal the set of tabs shown in the figure. Click the Libraries tab to specify the SWT packages required for your project.

Figure 1-6. Specifying the Java Build Path
On the Libraries tab, click the Add External JARs button and use the
dialog shown in Figure 1-7 to locate the
JAR file that contains the SWT classes (you
should have these from Section 1.1
Section 1.1. This file is normally
called swt.jar
and will be located in the directory
where you extracted the SWT development files.

Figure 1-7. Locating the swt.jar file
Note
Make sure you include swt.jar ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access