Supporting Technology

This section is intended as a repository of acquired knowledge with respect to supporting technology used with DrJava. For each tool or library, a section will address questions like:

Java Language & APIs

The Java language and APIs are documented by Sun at http://java.sun.com. The language actually exists in different "editions": Standard Edition (SE), Enterprise Edition (EE), and a collection of Micro Editions (ME). The Standard Edition is DrJava's target platform. See the JDK section of Getting Started for instruction on installing Java.

The language itself is documented by the Java Language Specification, available at http://java.sun.com/docs/books/jls. This is a good authoritative reference on the language, and any good Java developer should be familiar with it.

The java Command

Java sources are compiled to a collection of class files. These files can then be interpreted by a Java interpreter, which creates a Java virtual machine (JVM) and executes a class's main method. Sun's java is one such interpreter.

Documentation on the java command can be found with Sun's Java tools documentation.

A typical invocation of the interpreter looks like this:

java -cp lib/plt.jar:classes/base edu.rice.cs.MyClass

The -cp option specifies a class path — a collection of files or directories in which the necessary class files are located. This path is searched from left to right; when the code makes reference to an unknown class name, the first matching class file on the class path is used.

Directories of class files may be packaged and compressed into a single jar file for simplified distribution. These are essentially just zip archives of class file collections. In addition, a default main class can be specified for a jar file. Since all necessary classes for running DrJava are bundled into a single jar file, this allows the application to be run with a simplified command syntax:

java -jar drjava.jar

Standard Java APIs

DrJava is written in version 5 of Java, and makes extensive use of features that are new in that version. It's especially important that DrJava developers be quite comfortable with Java generics. Sun has posted a tutorial by Gilad Bracha that provides a good overview. There is also a a good summary of Java 5 features available in Sun's documentation.

The API specification is another essential reference for developers, available here: http://java.sun.com/j2se/1.5.0/docs/api/. A few important packages in the API include:

java.lang

The Object class, wrapper classes, strings, threads, and interface with the system are all defined here.

java.util

Standard lists, maps, and other collections are defined here. Note that the newer, non-synchronized classes (like ArrayList) are usually preferred over their older, synchronized counterparts (like Vector).

java.io

Provides access to file reading and writing and other file-system operations.

javax.swing

The DrJava GUI is implemented using Swing, the standard Java GUI framework. (Note that many Swing classes and concepts depend on the java.awt package.)

The Java Tutorial provides a collection of small tutorials covering different parts of the APIs.

Development in DrJava is limited in some ways by a desire for backwards compatibility. While the program is developed using Java 5, it is still released for platforms that only support Java 1.4. Thus, most classes and methods that were introduced with the Java 5 APIs cannot currently be used in DrJava. (Such classes and methods should be designated with a "since 1.5" tag in the API documentation.) For details, see the discussion on Retroweaver, a tool that enables this backwards compatibility.