Students programming in Java will use the BlueJ development environment on the individual electronic classroom machines. Hermes will be used to submit programs.
Using BlueJ to write and compile a Java program
- Locate BlueJ in the "Start" Menu. Once BlueJ loads, you'll notice that the BlueJ window
has a menu bar on the top, a series of buttons on the left pane, a large main window
in the right center pane, and an object bench along the bottom. The large window in
the right center pane is used to show a class diagram for the currently opened package.

- From the "Project" Menu, select "New Project." A dialog box will appear asking you to enter the project name. You may choose any project name you desire, but it's strongly recommended that you do not include spaces or non-alphanumeric characters. Note that BlueJ will probably default to the "My Documents" directory to save this project; this is acceptable, but please delete your files when the contest is completed. In the following examples, I've created a project named "Hello".
- To create a new class, click the "New Class..." button on the left pane. Another dialog
box will appear; enter the desired name of this Java class. (Remember that it is Java
convention to name classes beginning with a capital letter.) In the following example,
I've created a "Hello" class.

- You should notice a new rectangle in the center right pane. (The gray diagonal lines indicate that this class has not been compiled since last changed.)
- Double click the class rectangle to open an editor window. You'll notice that BlueJ
includes some "default" code. You should delete all of this code, except the "public
class Hello" line (replace "Hello" with the name of your class):

- Enter your code; when you're ready to compile, simply click the "compile" button at
the top of the editor window.

Using BlueJ to run a Java program
To run your program, close the editor window, (you should notice that the gray diagonal lines originally depicted on the class rectangle have disappeared), and right-click on the class rectangle. Then click the "void main(args)" option to run your program. A "method call" dialog box will then appear; just click "ok". BlueJ should open a console window as soon as it encounters a "System.out.print.." statement. This console window will serve as the means of screen output and keyboard input for your program.
Additional BlueJ issues
- When using the "readLine" method to read input from the keyboard, be sure to have a System.out.print... statement that executes before any call to readLine. The System.out.print... call tells BlueJ to open a console window; it's not smart enough to do this if a call is made to readLine first.
- Closing the BlueJ console window DOES NOT terminate your program! If you need to prematurely
end your program (i.e. in the case of an infinite loop, or you have a readLine statement
before a System.out statement), reset the virtual machine by following these steps:
1. Locate the horizontal "barber pole" in the main BlueJ window: If it shows red and gray stripes, your program is running. You can right-click this indicator and select "reset machine" to end your program.
2. If that doesn't work, then close BlueJ, wait a few seconds, and open it back up.









