< Day Day Up > |
Recipe 8.3 Adding the Required SWT JAR Files to the Build Path8.3.1 ProblemTo run an SWT application, Eclipse needs to know where to find the SWT classes. 8.3.2 SolutionAdd swt.jar to the build path. 8.3.3 DiscussionTo make an SWT application such as the one whose code we created in the previous recipe work, you need to satisfy the imports: package org.cookbook.ch08; import org.eclipse.swt.widgets.*; import org.eclipse.swt.*; . . . All you have to do is to include swt.jar in your build path. As you know, SWT is operating system-dependent, so a different swt.jar will exist for different operating systems. To add swt.jar to a project, select the project in the Package Explorer, right-click it, and click Properties. In the Properties dialog, click Java Build Path, and click the Add External JARs button. Then navigate to swt.jar, which you'll find in one of the following directories, depending on your operating system (HOMEDIR is the directory in which you installed Eclipse):
Browse to swt.jar, click Open, and then click OK.
8.3.4 See AlsoRecipe 8.2 on creating an SWT application; Recipe 8.4 on launching an SWT application. |
< Day Day Up > |