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 both the J2SE JDK 5 and the J2SE SDK 1.4 (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). The DrJava sources are written in the Java 5 language. However, in order to support users who only have Java 1.4 installed, the 1.4 SDK is also used in the build process. (Note: theoretically, any Java 5.0 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.)

If you like, you can set up your command-line environment to better support Java, but it's not strictly necessary. See Command-Line Environment Settings for details.

NoteRice 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.

NoteMac 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; it is difficult to set up a DrJava development environment in earlier systems. If you haven't done so already, you should install the Developer 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 tools from the ADC Web site. To see what is currently installed, go to /System/Library/Frameworks/JavaVM.framework/Versions.

For more information on Java in OS X, see 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.

NoteRice Java PLT
 

On the Rice Computer Science department network, the Subversion client is located at /home/javaplt/packages/RHE4/subversion-1.3.2/subversion/clients/cmdline.

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.

NoteRice Java PLT
 

On the Rice Computer Science department network, Ant is installed in the /home/javaplt/packages directory.

NoteMicrosoft 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.

NoteMac OS X
 

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

Command-Line Environment Settings

Once you've installed these programs on your system, you'll need to insure 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.

NoteUnix
 

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.

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.

NoteMicrosoft 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
JAVA_HOMELocation of the Java 5 installation. The specified directory should have a bin subdirectory containing java, javac, javadoc, etc.Specifies which Java installation Ant should use (not strictly necessary if the correct java command is on the command path).
JAVA14_HOMELocation of the Java 1.4 installation. The specified directory should have a bin subdirectory similar to that of JAVA_HOME.The DrJava build scripts use this variable to locate the 1.4 installation.
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).
PATHFor example, $PATH:$JAVA_HOME/bin:$ANT_HOME/bin.You will want the ant command on your path, as it will be used often. Ant requires svn on the path. 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. The Java commands are not strictly required to be available on the path, but it will probably be convenient to make them so.