No matter which IDE you use, you will need a Java Virtual Machine (JVM) in
order to run Java programs. To compile programs, you will also need a Software
Development Kit (SDK) for Java. Some IDEs come with an SDK, especially the
commercial ones. If you have an IDE already, check the documentation to see if
it includes an SDK. Also, Mac OS X includes an SDK.
If you do not have an SDK, download it from the Sun web page. At the time
of this writing, the current version of Java, 1.4.1, is available at this URL:
Download the SDK (not the JRE!) for your operating system, and carefully fol-
low the instructions for installing it.
DrJava is a free IDE for editing, compiling, and executing Java programs. It was
developed in Java itself by the JavaPLT group at Rice University. They are still
working to improve and extend it. It was designed primarily with students in
mind and is easy to use, but it does have some features that advanced program-
mers will appreciate. It is also open source , which means that you can download
and read the Java source code for DrJava. DrJava was written in Java!
DrJava is the simplest IDE that we have found. It provides the fastest, most
intuitive way to get started with programming of any IDE that we have used.
(Other IDEs have strengths that DrJava does not.) DrJava is available here:
Lesson 20 of
the CD con-
tion, and snap-
shots of the
do a better job
than we can do
Once installed, DrJava is easy to run. Suppose you downloaded drjava-sta-
ble-200300822.jar. To run it, just double-click its icon.
Alternatively, in a command line in a terminal window, type:
java -jar drjava-stable-20030822.jar
You will see a window with three areas, as shown in Fig. I.1. This is a snapshot
from a Macintosh running OS X; yours may look different. We made the win-
dow as small as possible so that it fits in this topic. The left pane contains a list
of files that you have opened. The right pane, called the “Definitions Pane”, con-
tains the Java code for the currently-selected file. The bottom pane, called the
“Interactions Pane”, allows you to try out Java statements and expressions.
Does it need tools.jar? In Windows, if you had to install the SDK, DrJava may ask you where
file tools.jar is. If you do not navigate to find it, you will not be able to com-
pile Java programs. Look for it where you installed the SDK, probably in fold-
er Program Files . Look for a folder named j2sdk1.4.0_01 (or something sim-
ilar). Inside it will be a folder lib , and inside lib should be tools.jar .