Building & Fixing Problems in Your Code

In this section, you will build Java projects and fix problems.

1.

Verify that there are currently no problems in the workbench by looking in the Tasks view, where build problems are listed if they exist.

2.

If it is not already open, then in the Packages view, double-click junit.framework.TestCase.java to open it in an editor.

3.

Add a syntax error by deleting the semicolon at the end of the first line in the file ( package junit.framework; ).

4.

Click the Save button when you are done. The project is incrementally built, and the problem is discovered.

Note: Only the changed file and the file depending on it are recompiled.

5.

The problem is indicated as follows:

  • In the Tasks view, the problems are listed.
  • In the Packages view, problem ticks show up on affected Java elements and their parent elements.
  • In the editor, a problem marker is displayed near the affected line.

6.

Hover over the problem marker in the marker bar in the editor area and view the information in the hover help.

7.

Click the Close button on the editor's tab to close the editor.

8.

In the Tasks view, select the problem in the list, and from its context menu, select Go to File. The file where the problem is detected opens in the editor area, where the problem is shown.

9.

Correct the problem in the editor by retyping the semicolon, then click the Save button.

The project is built automatically on the save, and all the problem indicators in the workbench disappear.