How can I create a simple "Hello World" / console application in JBuilder?

By: Josh Fletcher

Abstract: How to create a simple console-based Java application in JBuilder.

Question:

How can I create a simple "Hello World"/console application in JBuilder?

 
Answer:

To create a simple console application in JBuilder, follow these steps:

  1. File | New Project | Finish
  2. File | New Class
  3. Make sure "Generate Main Method" is selected
  4. Click OK
  5. Edit the new class and add the following line in the "main()" method:
         System.out.println( "Hello World!" );
  6. Run | Run Project
  7. In the "Runtime Properties" dialog, specify the "Main Class" (the class that JBuilder will run):
    1. Click the "..." button next to the "Main Class" field. This brings up a "Class Browser"
    2. Use the Class Browser to find the class you just created (e.g. "untitled1.Untitled1")
    3. Select the class and click OK
  8. Click OK to close the Runtime Properties dialog and run the program.

At this point the JBuilder Message Pane will open and the output from running your new console program will appear there. The first line will be the command line that JBuilder used to run the program. Note that you can cut and paste this line into a console window/DOS box and run your program.

You should see "Hello World!" printed on the next line. Also notice that the green "Play" button is enabled at the bottom of the Message Pane. If you click this button, the program will run again. Do so, and notice that the red "Stop" button enables. If you quickly press the stop button, the execution of your program will be interrupted and you will see no output. Use this button to manually stop any programs you run.

As a final note, if you need to do console input, the JBuilder Message Pane handles this as well. When your application is ready for input, just click in the Message Pane and start typing.

 

Server Response from: BDN10A

 
Copyright© 1994 - 2008 Embarcadero Technologies, Inc. All rights reserved. Contact Us   Site Map   Legal Notices   Privacy Policy   Report Software Piracy