Exercise 2: Fixing Errors in a Build

The goal of this exercise is to show you how to quickly locate and fix the source line responsible for an error found during the build process. Build errors usually include incorrect language syntax, undeclared variables, and misspelled keywords.

If you have not yet added the code to bounce the words in the Blink project, you should do so now. Step-by-step instructions are in Editing Source Code.

Locating Errors

  1. Check the Java WorkShop tool bar for the name of the current portfolio and project.
    If the current portfolio is not "personal," choose Portfolio => Choose => personal. If the current project is not Blink, choose Project => Choose => Blink.

  2. Click the Build Manager control on the WorkShop tool bar.

  3. Click the Initiate a Build control on the Build Manager tool bar.
    The Build Manager lists four errors.

Fixing Errors

  1. Click the first error.
    The Source Editor opens and displays the source line responsible for the error. The line is highlighted in yellow. The error is also highlighted in yellow in the Build Manager.

  2. Fix the error by adding parentheses around offset.
    Your line should look like this:

    if (offset)

  3. Click the Next Error control in the Source Editor tool bar.
    The Source Editor displays the source line responsible for the error.

  4. Fix the error by adding a } before else.
    Your line should look like this:

    } else {

  5. Click the Save File control in the Source Editor tool bar.
    In this example, each error generated two error messages. Your program should be now be fixed and you can rebuild your program.

Rebuilding the Project

  1. In the Build Manager, click the Initiate a Build control .
    You should not get any error messages. If you do, go back to the Source Editor and double-check your code to see if you typed in the information correctly.

  2. Close the Source Editor.

  3. Click the Project Tester control on the WorkShop tool bar.
    The WorkShop runs your project. The text now bounces up and down in addition to blinking on and off.

Next lesson:

You have completed the lessons in this tutorial. The next tutorial is Tutorial Four: Browsing a Project.