Installing Essential Software

You will need to have three programs properly installed and set up on any system you intend to use for development. These are the Sun Java Development Kit (for compilation), a Subversion client (to access the source code repository), and Apache Ant (for scripted building).

Sun Java Development Kit

If it's not already installed on your system, you can download the JDK from Sun's Web site. You will need to have installed the JDK version 5 (note the distinction on the download pages between a Java Runtime Environment, which just contains the tools needed to run Java programs, and a Java Development Kit, which contains a compiler and other tools, in addition to the runtime application). You may also want to install JDK version 6. The DrJava sources depend on Java 5 (but not 6) language features and APIs. (Note: theoretically, any Java 5 compiler should be able to handle the DrJava sources. However, there are currently some dependencies on Sun's tools in the main DrJava code module, so you will need to have those tools available.)

You should set up your command-line environment so that you can access the java and javac commands. See Command-Line Environment Settings for details.

Rice Java PLT

On the Rice Computer Science department network, various versions of the JDK are installed at /home/javaplt/java, organized by platform (such as Linux-i686) and then by version.

Mac OS X

Java is built in to Mac OS X, which makes Apple, rather than Sun, the main source of core Java software for the platform. Java 5 is only supported since version 10.4 (Tiger) of the operating system, and Java 6 requires OS X 10.5 (Leopard) and a recent (64-bit Intel) machine. If you haven't done so already, you should install the Xcode Tools, distributed on CD or DVD with the OS, and also available from the Apple Developer Connection (free membership may be required). This will contain at least the Java 1.4 tools. If you need to, you can then dowload the Java 5 or Java 6 tools from the ADC Web site. To see what is currently installed, go to /System/Library/Frameworks/JavaVM.framework/Versions.

To select which version of Java is used to launch applications and to run command-line tools, run /Applications/Utilities/Java/Java Preferences. There is no need to manually adjust the PATH variable or manipulate symbolic links.

For more information on Java in OS X, see Apple's Java development page and, specifically, this FAQ.

Subversion Client

The DrJava source code is stored on a SourceForge server using Subversion. This allows changes to the sources to be tracked and permits a number of developers to work on different parts of the code at the same time. In order to access the source repository, you will need a Subversion client. See the Subversion Web site for links to a client for your platform.

Your command-line path will need to be set up so that the svn command is available. See Command-Line Environment Settings for details.

Rice Java PLT

On the Rice Computer Science department network, the Subversion client is located at /home/javaplt/packages/subversion-1.5.4/bin.

Mac OS X

Subversion is installed with recent versions of Xcode Tools. See the previous note for instructions on installing Xcode. After this installation, you can find out if you have Subversion by typing svn --version at the command line.

Apache Ant

Ant is a build script interpreter — loosely a Java- and XML-based alternative to the make command on Unix systems. It can be downloaded from Apache's Web site. Decompress the package and copy the jakarta-ant-xxx folder to a convenient location (such as /usr/local, your home directory, or C:\Program Files).

Once installed, you should follow Apache's installation recommendations for setting up your environment. See Command-Line Environment Settings for details.

Rice Java PLT

On the Rice Computer Science department network, Ant is available in the /home/javaplt/packages/apache-ant-1.x.x directories.

Microsoft Windows (95, 98, & Me)

According to the Ant installation instructions, the ant executable script will not work correctly in older Windows systems if Ant is installed in a location with a long filename. They recommend creating a C:\ant directory. See the Ant Manual for details.

Mac OS X

Ant is installed with the Xcode Tools. See the previous note for details.

Command-Line Environment Settings

Once you've installed these programs on your system, you'll need to ensure that your command-line environment is set up properly. Because shells vary widely in the conventions they use, you may need to familiarize yourself with the idiosyncrasies of your particular platform.

Unix

On Unix systems, the environment variables can be set by modifying a login script file. Assuming you are running a bash shell, you can see how your environment is currently set up by typing env. You can also use which to test the PATH variable — for example, which ant will print a full path to the ant executable if Ant is correctly set up. It is important to check the current settings before making changes.

To make changes to the default environment settings, edit (or create) the .bashrc file in your home directory to contain the needed declarations. (On some systems, such as Mac OS X or the Rice Owlnet network, you should use the .profile file instead.) Under bash, an environment variable is set with a command like the following:

export ANT_HOME=/usr/local/ant

Note that path-like variables (such as PATH and CLASSPATH) should use a colon (:) to delimit filenames. You can use a variable's value at any time (both in a later declaration and at the command line) with syntax like $ANT_HOME.

After making changes, you will need to open a new terminal window before the settings will take effect.

Microsoft Windows

Each version of Windows has a slightly different method for setting environment variables. In most cases, you can select System in the Control Panel (or choose Properties after right-clicking on My Computer), and then find a button for Environment Variables (usually on the Advanced tab). You may need to log out and back in before your settings will take effect. Note that path-like variables (such as PATH and CLASSPATH) should use a semicolon (;) to delimit filenames. You can use a variable's value at any time (both in a later declaration and at the command line) with syntax like $ANT_HOME [TODO: is this true?].

If you're using Cygwin (a Unix-like environment for Windows), many of the Unix instructions above are relevant. You could, for example, define the environment variables in a .bashrc file. However, it's probably best to use the system-wide Windows facilities (such as the Environment Variables dialog box) whenever possible. One problem you will encounter when using Cygwin is that Windows filenames and paths are formatted differently from Cygwin filenames and paths. Generally, Java applications (including Ant, with some exceptions) will only be able to handle Windows-style paths. On the other hand, some Cygwin programs expect Cygwin's Unix-like paths. To deal with this problem, you may need to thoroughly familiarize yourself with the cygpath command, which converts between the two formats.

The following table summarizes the variables and corresponding values that should be set up on your system:

VariableValueNotes
JAVA5_HOMELocation of the Java 5 installation. The specified directory should have a bin subdirectory containing java, javac, javadoc, etc.Required in order to locate the correct standard libraries when compiling. Rice CS: /home/javaplt/java/Linux-i686/1.5.
JAVA6_HOMELocation of the Java 6 installation. The specified directory should have a bin subdirectory containing java, javac, javadoc, etc.Optional; makes it possible to explicitly request that Java 6 be used by the Ant script when running or testing. Rice CS: /home/javaplt/java/Linux-i686/1.6.
ANT_HOMELocation of the Ant installation. The specified directory should contain the bin and lib subdirectories.The Ant command generally needs this in order to work correctly (although on some platforms Ant will work fine without it). Rice CS: /home/javaplt/packages/ant.
PATHFor example, $PATH:$JAVA_HOME/bin:$ANT_HOME/bin.You will want the ant command on your path, as it will be used often. The Ant script requires that java, javac, and svn be available from the command line. You may want to explore the current settings before you make any modifications. Note the use of previously-declared environment variables in this example. Also keep in mind that the first matching location for a command in the path will shadow all later matches.