Software (Object-Oriented Programming)
[The links on this page are all broken, but anyway would lead to software that is long out of date. If I revive the course, then I'll update them. Mike]
In the Labs, we will be using BlueJ, a simple Integrated Development Environment that supports Java. If you want to practice Java programming on your own machine, then it would make sense to install BlueJ on it too. These instructions will take you through the process of installing BlueJ on a machine running Windows 2000 or XP or Vista.
If you have a Linux machine, then count yourself a l33t h4X0r! I won't insult your intelligence by giving you detailed installation instructions, but there are links at the end of this page for downloading the files you need.
If you have a Mac, then count yourself a c00l d00d, and look even closer to the end of the page for instructions and advice.
Contents |
Software for Windows
Getting the files
BlueJ sits on top of Sun's Java Development Kit (JDK), so you will need to install both JDK and BlueJ itself. For convenience (and to avoid confusion), here are the two files you need. Right-click on each of the links below, choose "Save target as ...", and save the file on your desktop.
- Java Development Kit 6 Update 2: jdk-6u2-windows-i586-p.exe
- BlueJ version 2.2.0 for Windows: bluejsetup-220.exe
Installing JDK
Double click on the file jdk-6u2-windows-i586-p.exe on your desktop. You may see a security warning a bit like this:
It's OK to click Run.
A Windows installer will start, and you will need first to accept the Sun licence agreement, then to accept the default list of features to install. Now the basic JDK will be installed.
Then you'll be prompted to choose additional features to install. Again accept the default.
Now you will be asked which web browsers you wish to register for use with the Java Runtime Environment. Since you've just installed the latest version of JRE, it will do no harm to accept the default of registering all the browsers you have installed.
Finally, the message "Installation Completed" appears, and you can click on "Finish".
Installing BlueJ
Double click on the file bluejsetup-220.exe on your desktop. Again, you may see a security warning like this:
Again you should click on Run, and a Windows installer will appear.
You will need to click on Next several times to accept the default settings, then on Install.
BlueJ will now be installed. After you click on Finish, you'll be shown the Readme file. There's not very much of interest here, so you can close the window in the usual way.
You can now delete the two files you downloaded.
Then double-click on the desktop icon to start BlueJ.
If you want to enable checking of assertions in your programs, then see the section on enabling assertions below.
Software for Linux machines
For a Linux machine, you need one of the two packages containing JDK, and the JAR file that contains BlueJ:
- JDK as an RPM in a self-extracting file (for Red Hat-ish distributions).
- JDK as a self-extracting file (for other flavours of Linux).
- BlueJ packed in a JAR file.
After installing JDK, you need to give the shell command
$ java -jar bluej-220.jar
Then a window will appear asking you to choose a location for installing BlueJ. Run the installer as super-user if you want to install it in a public place such as /usr/local/bluej. Then maybe make a symbolic link with
$ ln -s /usr/local/bluej/bluej /usr/local/bin
Now you're ready to start BlueJ by giving the command bluej at the shell prompt.
See below for instructions on enabling assertions.
Software for Macs
Stephen Cameron tells me that installing BlueJ on a Mac is "a doddle", provided you have a zip file utility such as Stuffit Expander. I have no reason to doubt his word on that.
Enabling assertions
With any of Windows or Linux or a Mac, you have to do something special to enable checking of assertions in the Java programs you run under BlueJ. Edit the file called lib/bluej.defs within the BlueJ installation. (Under Windows this will be the file C:\BlueJ\lib\bluej.defs, and under Linux the file is /usr/local/bluej/lib/bluej.defs). Find the line that says
bluej.vm.args=-server -Xincgc
and change it to
bluej.vm.args=-server -Xincgc -enableassertions
Now save the file and restart BlueJ.

