Hello World!

Updated: Wednesday, August 21, 2002

Creating the "Hello" Project

To begin with, you need to create a JBuilder "Project" to contain all of the program files and settings for the "Hello World!" program. You will need to do this for every new program. For "Hello World!" follow these steps. For another project you would change the names appropriately.
  1. Start the Borland JBuilder7 IDE. (See screenshot.)
  2. If you see the Tip of the Day dismiss/close it.
  3. If the "Welcome" project is open, close it too.
  4. Click on the New button.
  5. Click the Project tab, then select the Project icon, then click the OK button. (See screenshot.)
  6. In the "Step 1" wizard dialog box, enter "Hello" (no quotes, upper case "H") for the project name. Make sure the checkboxes match those in this screenshot. Click the Next button.
  7. In the "Step 2" wizard dialog box, accept all of the defaults, and simply click the Next button.
  8. In the "Step 3" wizard dialog box, enter title, description, company, and author information as shown here. Use your name!

Creating the Main Class (Program)

Next you need to actually write the (simple) program, by creating a main class with one simple instruction. We will discuss classes and the meaning of all of this later, but for now, just follow these steps. For another project you would change the names appropriately.
  1. With the "Hello" project open (see above), click on the New button again.
  2. Click the General tab, then select the Class icon, then click the OK button. (See screenshot.)
  3. Enter/accept "hello" (no quotes, all lower case) for the Package name, "HelloMain" (no quotes, capital "H" and "M") for the Class name, and make sure the checkboxes match those in this screenshot. (Only "Public" and "Generate main method" should be checked.) Click the OK button. You should now see something like this.
  4. In the "HelloMain" source panel on the right (note tha Source tab at the bottom) add the line
    System.out.println("Hello world! My name is Prof. Welch");
    as shown in this screenshot. Replace "Prof.Welch" with your name.
  5. Click on the Save All button to save your class file and project.

Running the Program the First Time (Default Run Properties)

Now that have created the Project and the Main Class, you are just about ready to run your first Java program. The very first time you run a (new) program, there are a few extra steps you need to take. You will need to do this for every new program. For "Hello World!" follow these steps. For another project you would change the names appropriately.
  1. Click on the "Run Project" button at the top of the JBuilder IDE window. The button is the first of three right-facing green triangles. (It looks something like the "play" button on a CD player....)
  2. You will see a "Project Properties" dialog box appear with the "Run" tab selected. We need to tell JBuilder a few things about the project. We need to do this only one time (for each new project). Click on the New... button.
  3. You will see a "Runtime Properties" dialog box appear. Click on the browse button (...) to the right of the "Main class:" field.
  4. You will see a "Select Main Class for Project" dialog box appear. If necessary, click on the right-facing triangle next to the "hello" package (cute little wrapped package icon...), select the "HelloMain" class in the "hello" package, and click the OK button. (See this screenshot.) Note that this is the "HelloMain" class you created above.
  5. You should then be returned to the "Runtime Properties" dialog box, but this time you should see "hello.HelloMain" in the "Main class:" field. (FYI, the "dot" notation used in "hello.HelloMain" means the "HelloMain" class of the "hello" package. We will cover this later.) Type "Default Runtime Configuration" in the "Configuration name:" field. Click on the OK button.
  6. You should return to the "Project Properties" dialog box with the "Run" tab selected. You should now see your "Default Runtime Configuration" listed. Check the "Default" checkbox to make this the default configuration for your "Hello World!" project. Click on the OK button. You should be returned to the main JBuilder IDE window.
  7. Repeat step 1 above and click on the "Run Project" button at the top of the JBuilder IDE window. You should see some lines of text appear in the "HelloMain" output pane at the bottom of the window, hear a pleasant "success" sound (we hope), and finally see your "Hello World! My name is...." appear.
  8. Click on the Save All button to save your class file and project.

Re-Opening, Editing, and Re-Running the Program

You should have already created a Project, a Main Class, and default run properties (above). Now you can re-opn (if necessary), edit, and run the program much more simply.
  1. If necessary, open the project by choosing the Open Project... item from the File menu.
  2. Find and select your "Hello" folder on the left, select the file "Hello.jpx" on the right, and click the OK button. (See the screenshot.) Your "Hello" folder should be in a "jbproject" folder, which if you using a PC in an ATN public lab should be in a "comp14" folder on your H: drive (your ISIS AFS space). FYI, the "jpx" extension is the default for a JBuilder project file.
  3. Click on the "Run Project" button at the top of the JBuilder IDE window. You should see some lines of text appear in the "HelloMain" output pane at the bottom of the window, hear a pleasant "success" sound (we hope), and finally see your "Hello World! My name is...." appear.

You can now edit the program, and re-run it at will. I suggest you make only simple changes to the words inside the quotes. For example, change your name to Lisa or Bart Simpson. Make sure to change it back to your name to receive full credit on the assignment.

Complete the Code Requirements

  1. Copy the standard program header with pledge and paste it into your HelloMain.java file as shown here.
  2. Replace the bracket text (e.g., "[your name]") with complete/proper information for you.
  3. Add the other comments as specified in the "HW00 Hand-Out Document" (on line).
  4. Test your program again.
  5. Click on the Save All button.

Print it, Pledge it, and Turn it in

  1. Print the file MainClass.java (put the cursor in the HelloMain pane, choose Print from the File menu, etc.)
  2. Sign the pledge on the printout.
  3. Follow the standard assignment procedure (which includes the above pledge step) to complete the assignment, and get your demo and code grades.