Borland JBuilder 3

JBuilder 3 is a good tool for compiling, running, and debugging the programs in Computing Concepts with Java 2 Essentials.

Note: JBuilder 1 cannot compile Java 2 programs and therefore cannot be used with the book. JBuilder 2 can be configured to compile Java 2 programs if you also install the JDK, but it cannot debug them. I do not recommend that configuration for Java 2 programming. If you are using JBuilder 1 or 2, I suggest that you upgrade to JBuilder 3.

Compiling a program

To compile a program, follow these steps:

  1. Select File | New... from the menu. You get a dialog box like this:
    {short description of image}
    Double-click on the Project icon.
    Tip: To bypass this dialog, simply select File | New Project... instead.
  2. You get the project wizard dialog:
    {short description of image}
  3. Use the Browse button to pick a directory for your work, such as yourname\homework. Come up with a name for the project (such as Hello or Homework1).
    Tip: It is best to use a separate directory for each project.
  4. You can leave the other entries with their default values--they aren't important. Click on Finish. You get a screen that looks like this.
    {short description of image}
    Note: If you already have an HTML file with the same name as your project (such as a file with an APPLET tag), you will be asked whether that file should be replaced. In that case, answer No.
  5. Click on the folder icon with the green +. You get a file dialog. Type in the name of your Java file (such as Hello.java). If the file doesn't yet exist, then confirm that you want to create a new file.
  6. Type your program into the Source window. Save your file by choosing File | Save from the menu. Your window should look like this:
    {short description of image}
  7. Select Project | Properties from the menu. Set the Source and Output directories to the same directory as your project file (such as yourname\homework).
    {short description of image}
    Note: Setting the source path is not necessary for compiling and running the program, but it is required to run the debugger. The debugger won't find your source files if you don't set the source path. Setting the output path is not strictly necessary for compiling and running, but if you use the default output path, all classes are dumped into the same directory, and you get unsightly warnings about classes with missing source.
  8. Select Project | Make Project . . . from the menu. Fix any compiler errors that may occur.

Running a program

Running your program is slightly different depending on whether you run

Running a console application

To run a console application, follow these steps:

  1. Choose Project | Properties from the menu. Click on the Run/Debug tab. You will get a dialog like this one:
    {short description of image}
    Uncheck the Close Console Window on exit check box. Click OK.
  2. Select Run | Run . . . from the menu. Your program will run.
    {short description of image}
  3. When your program is finished, type Ctrl+C to return to JBuilder.

Running an applet

To run an applet, follow these steps:

  1. In the project tree on the left hand side of the project window, click on the HTML file. Then click on the Source tab on the bottom of the window. You get a display like this:
    {short description of image}
  2. I recommend you simply remove all project notes text and enter the APPLET tag instead.
    {short description of image}
    If you use the "Project Notes" feature, you can keep your notes and insert the APPLET tag directly after the BODY tag.
  3. Select Run | Run . . . from the menu. Your applet will run inside the applet viewer.
    {short description of image}
  4. Close the applet viewer window when you are finished running the applet.

Running a graphical application

To run a graphical application, follow these steps:

  1. Select Run | Run . . . from the menu. Your graphical application will run.
    {short description of image}
  2. Close the appication window when you are finished.