Java Reference
In-Depth Information
Then, import the files from the Chapter 2 exercises, using the same steps used
to import the files from the Chapter 8 exercises. In the Filter Types dialog in the Im-
port function, add *.html and *.java to your choices so that you get the java source
and the HelloWorld.html file, which you will need to run the applet. Make sure to
point the target of the import to Chapter2\src.
After Eclipse has imported the Java and HTML files, you will notice a red X box
in the Package Explorer. Follow the red boxes to find the problem, by opening each
subdirectory with red X boxes in the project, until you get to the applet\HelloWorld
Java file. Double-click on that file.
You should see the applet\HelloWorld Java source opened in the code window,
and a red X box on the first line, as shown in Figure 17.8.
FIGURE 17.8
Applet in Eclipse with error.
Click on the red X box in the code window. Eclipse will offer a suggestion to
fix the problem by adding the package declaration “applet” to the file. Double-
click the suggestion, and Eclipse will add the line package applet ; at the top of the
Search WWH ::




Custom Search