bluej-logo BlueJ
Search the BlueJ site

about BlueJ
help & Info

BlueJ for AP* Computer Science

This page gives some hints about setting up BlueJ for the US Advanced Placement (AP) course.

This page describes using the GridWorld case study with BlueJ. An older page covering the Marine Biology case study is here.

Note: If you are interested in GridWorld in BlueJ, you may also be interested in GridWorld in Greenfoot - a much more interactive and flexible version.


Using the GridWorld Case Study with BlueJ

After downloading and installing BlueJ, follow these easy steps:

  • Download the BlueJ version of GridWorld here.
    (This version is based on Cay Horstmann's "Unofficial Code", version 1.01. This version is slightly newer than the "official" College Board code, so I've used this version as the basis for the BlueJ variant.)

  • Choose where to store it, and unzip the file. This will create a folder named "GridWorldCodeBlueJ".

  • Add gridworld.jar to the BlueJ libraries. gridworld.jar is a file in the GridWorldCodeBlueJ folder. You add it to BlueJ's libraries by following these steps:
    • In BlueJ, go to Preferences/Libraries.
    • Select "Add", choose the gridworld.jar file, and click Ok.
    • Restart BlueJ.

That's it, you're done. You can now open and use the projects in GridWorldCodeBlueJ/projects.


Other possible BlueJ configuration

Other possible configurations suggested here are:

  • Adding documentation for GridWorld and the AP library subset
  • Using a local copy of the documentation
  • Changing the class templates

Adding the GridWorld documentation

The GridWorld package that you downloaded includes documentation (in the javadoc folder) that can be very useful. You can add a link to this documentation to BlueJ's Help menu.

  1. Open the bluej.defs file (see here for detailed instructions).
  2. In that file, search for the '' property.
  3. Add the following lines: Documentation
    <URL for your local documentation>

To do this properly, you have to find and insert the correct URL for the documentation file. To do this, navigate into the GridWorldCodeBlueJ/javadoc folder, find the file 'index.html', open it in your browser, and then copy the address out of the browser's URL field. Insert it at the right place in bluej.defs.

Now your help menu should include an entry for the GridWorld documentation.

Adding the AP library subset documentation

Owen Astrachan has published documentation of the AP library subset. You can make this documentation available from BlueJ's help menu. Essentially, you do the same as above:

  1. Open the bluej.defs file (see here for detailed instructions).
  2. In that file, search for the '' property.
  3. Add the following lines: Java libraries

That's all. The 'Java Class Libraries' menu item will now open the AP subset documentation.

Using a local copy of the documentation

The above suggestion uses the online API over the internet. You can also install the AP documentation on your local disk, and then use the local copy. That way, it is faster, and you do not have to be connected to the network to use it. To do this, download the documentation ( from Owen Astrachan's web site and use a file URL to the local version instead of the http URL given above.

The easiest way to do this is to open the local copy of the documentation in your browser, and copy the URL out of the browser's address field.

See also Using a local copy of the Standard Java API.

Changing the class templates

Most teachers have personal preferences how they want classes layed out, what should be included in class comments, etc. This can be greatly supported by custom class templates. The templates that BlueJ provides can be modified to suit your own style. Read Changing the default class template for instructions.


Other options

You may also be interested in using Greenfoot instead of BlueJ. If you run GridWorld in Greenfoot, you will have much more interaction and flexibility then in BlueJ or other environments.

* AP is a registered trademark of the US College Entrance Examination Board, which was not involved in the production of, and does not endorse, this web page.



Discussion Group



For notificaton of new releases, subscribe to: BlueJ-announce

Bug Parade
View or submit bugs
maintained by
Michael Kölling
supported by Oracle logo