| Computer Sciences 303E Creating Projects and Running Programs in BlueJ CS 303E · The University of Texas at Austin · Spring 2001 |
This page has lots of pictures and will take a long time to load if you are using a slow modem connection.
You need to have downloaded and installed BlueJ before completing the following steps.

When BlueJ is up and
running go to the Project Menu and select New

This opens a new window.

From this window type in the name of the new project in the text field File
name. The name of the project does not have to be the same
as the name of the java file you will later add to the project. It can
be anything you want.
After giving the new project and name and clicking Create
you see the new project.

There aren't any classes or code associated with the project yet. The
icon that looks like a piece of paper is just a simple text file that acts
as the projects readme file. You can double click on it to add
comments about the project as a whole or write notes to yourself on things
that need to be done. You probably won't use it much at first.
Now you need to add the code or java file(s) to the
project. To add the existing file to the project click on the Edit
menu and then select Add Class from File...

A new window pops up that allows you to select the file you
want to add. Only files that end in .java are shown.

I have had trouble with the Up One Level icon. Sometime it has
worked, but sometime I have had to use the upside down triangle next to the
bluej folder to get the drop down list to show up and then navigate to where
the file is I want to add. Navigate to where the file is you want to
add. Click on it to add it to the project.
Now the new file / class has been added to the file.
It shows up with diagonal lines because it has not been compiled yet.

To edit a program / class double click on that program /
class and it pops up in a text editing window.

You can type in the window to change the program. You
save the program by clicking on the Class menu and selecting Save.
You can attempt to compile the program by clicking the Compile
button. Any errors will show up in the text area at the bottom of the
edit window. If an error occurs the line the error is on is
highlighted in gray. After compiling the program and getting it to
work close the editing window w and go back to the project window. The
program / class icon no longer has diagonal lines across it.

To run the program right click on the icon that has the main
method in it. This brings up a menu that allows you to carry out
various actions. (You could also compile classes here.) Select the
menu option void main(args). This causes the main method of the
class to be executed.

Another menu pops up that asks what parameters or
information you want to pass to the method, in this case main. In this
class we won't normally pass any information to method main so just click
OK.

This causes the program to run.

If you want to clear out the terminal window before running
the next program then be sure to click on the Options menu and
pick Clear.

Later, when you write your own classes you will create new classes in BlueJ by clicking on the Edit menu in the project window and selecting New Class... This causes a new class to be brought up. The new class has lots of example code that should be deleted.