How to use DrJava on your own machine

There are three pieces of software you must have in order to do your lab/homeworks on your own machine:

  1. The Java system
  2. DrJava
  3. The acm.jar file

They all come from different sources. The first, the Java JDK, is required so that you can compile and execute Java programs. The second is the Integrated Development Environment (IDE) that provides a simple way to edit and test your programs. The third is the graphics library that we will use. There are links to all three in the menu on this page.

Download all three, making sure that you get the right version of Java and DrJava for your "platform" (hardware and operating system). The ACM Java library is platform-independent since it's written in Java itself.

Once you have downloaded all the software, you must set up DrJava so that it knows two things:

  1. where to find the file tools.jar, which allows it to compile and run programs, and
  2. where to find the file acm.jar

In order to do this, start up DrJava. On a Windows or Mac OS X machine you should have an icon for this. On a linux machine, I can help you with it. On startup, DrJava will sometimes complain that it can't find tools.jar, and will give you a chance to specify its location. You should find out where it is (use your operating system's search facility), and tell DrJava the location. Now you should be able to compile and run simple Java programs that don't use acm.jar.

To specify the location of the acm library, use DrJava's Edit menu, and select Preferences. You're going to add an extra classpath. Click the Add button; a popup window will appear to allow you to select a .jar file. Again, you must know where you put the acm.jar file. Navigate to it using the popup window and press the Select button. The file name should now appear in the Extra Classpath field.

Once you've done this, you shouldn't have to do it again; DrJava saves this information for you.