Frequently Asked Questions

( last modified Monday, 10-Aug-2009 23:29:18 UTC )

What version of Java does DrJava require?

To take full advantage of DrJava's features, you will need to have either the JDK 6.0 or the JDK 5.0 installed on your system. We highly recommend version 6.0, as it provides a number of additional APIs and GUI improvements. The J2SE v 1.4.2 SDK is no longer supported.

How do I change the version of Java used by DrJava?

To change the compiler version, simply select an entry from the drop-down list in the "Compiler Output" tab. Note that this list only includes compilers found by an extensive, but not comprehensive, search of typical install locations, and that after an initial search, any duplicates with the same major JDK version number are filtered out. (You can point to a specific compiler with Edit->Preferences->Resource Locations->Tools.Jar Location.) Also note that DrJava cannot run a compiler for a Java version more recent than the one used to run the DrJava application (read on for a solution).

To change the version of Java used to run the DrJava application, you will need to change your system settings so that DrJava starts up under the correct version. may experience problems if you try to run DrJava under one version and use a tools.jar file from a different version.)

  • In Windows, the last installed JRE generally becomes the default. Take a look at Sun's installation instructions for details.
  • In OS X, the "/Applications/Utilities/Java/Java Preferences" application will allow you to change to default Java version (under "Java Application Runtime Settings").
  • In a command-line environment, simply ensure that the "drjava[...].jar" file is passed to the right version of the "java" command. (You might try "which java" to tell you where the java command is located, and make changes to the PATH environment variable as necessary.)

Why won't DrJava start on Windows?

If you get an error message from Windows when running DrJava (before the DrJava splash screen appears), you probably either do not have Java installed or it is not configured correctly. First, ensure that you have installed the Java Software Developer Kit (SDK) and not just the Java Runtime Environment (JRE).

If you still cannot run DrJava, try downloading the "Jar File" rather than the "Windows App" from the DrJava home page and double clicking on it. If Windows asks you which program to use to open the file, select "javaw.exe" (which should be located in "C:\Program Files\Java\j2re...\bin\javaw.exe" or a similar folder).

I'm being prompted to locate the tools.jar file. What is that?

The tools.jar file is part of the Java SDK (or "JDK") and contains the libraries that DrJava needs in order to run the compiler, debugger, and other language tools. DrJava looks in a number of typical locations to find the file, but if it can't find it, you may be prompted to point to it.

Make sure a supported version of the JDK (not just a "JRE") is installed on your system. When you've located the installation, you should be able to find the tools.jar file in the "lib" folder.

I'm unable to compile. I get a "cannot read zip file entry" error. What should I do?

Sometimes, when DrJava is used with the JDK 6.0, update 4 or newer, DrJava will report the following error when you try to compile:

Error: error: error reading D:\path\drjava-beta-20090505-r4932.exe; cannot read zip file entry

This error is due to a bug in JDK 1.6.0_04+. DrJava "exe" file releases prior to 20080415 are affected. Windows users experiencing this error should upgrade to a more recent DrJava version, which includes a workaround.

We believe we have addressed this issue, but in some cases it seems to still occur. We cannot reproduce this situation, though.

If this happens to you, please use the .jar file of DrJava instead of the .exe file. This will avoid the problem.

Why do I get a ZipException when trying to run DrJava?

If you get the following error message when running DrJava for the first time, your copy of DrJava is likely corrupted. Try downloading DrJava again, perhaps using the "more download options" link on our home page.

  Exception in thread "main" error in opening zip
        at Method)
        at java.util.jar.JarFile.(
        at java.util.jar.JarFile.(

Why do I get an exception with the message: "Interpreter JVM exited before registering, status: 3"?

It is likely that a personal firewall is not allowing DrJava to send data to the address (also known as localhost). DrJava does not require an internet connection to run, but it does require the ability for the two Java Virtual Machines it uses to communicate over the computer's internal network. To fix this problem, configure your firewall to either allow DrJava to access the network, or make a trusted address.

Why does DrJava crash on Linux with the Compiz window manager?

This issue is caused by an incompatibility between Compiz and Java, and we, the developers of DrJava, cannot do anything to fix this problem. We hope that future versions of Java and Compiz will address the incompatibility. In the meantime, we recommend that you disable Compiz if you experience problems. We also suggest that you use the latest versions of Compiz and Java, so you can benefit from possible bug fixes made by Sun and the Compiz developers.

More information about using DrJava with Compiz

Why can't DrJava compile any files?

If you encounter a "No Compiler Available" message, DrJava was not able to find a compatible copy of the "tools.jar" file, which comes with the Java SDK and contains the Java compiler. Note that versions of Java prior to 1.4 are not supported in the latest DrJava releases. You can specify the location of "tools.jar" by choosing "Preferences" from the Edit menu, choosing the "Resource Locations" section, and entering the location into the "Tools.jar Location" field. (The "..." button next to the field allows you to use a file dialog to locate the file.)

If compilation consistently produces a "cannot read zip file entry" error, see the item above addressing this issue.

How can I quickly re-indent a large number of files?

DrJava has a very useful indenting algorithm, but indenting several large files can be time consuming. Because of this, we provide a command line interface to the indenter that you can run on a series of files. From a command line, use the following command to run the indenter:

java -classpath drjava-VERSION.jar edu.rice.cs.drjava.IndentFiles [-indent N] [FILES]

Where VERSION is the correct version number for your copy of DrJava and FILES is a list of the files you wish to re-indent. You can optionally specify the -indent argument, where N is the number of spaces to use for each indentation level. Note that tab characters are not supported.

Why are printouts so slow?

Java appears to require all printing to be done using images rather than pure text, so each printout involves converting the document into an image. This image can become very large, which might take a long time for a printer to process.

How does the Interactions interpreter differ from standard Java?

You can think of the Interactions interpreter as a step-by-step evaluator for a "main" method body. However, to make usage more convenient, a number of extensions are supported. There may be an option to turn these features off in a future release.

  • The statement java SomeClass arg1 arg2 is a shortcut for SomeClass.main(new String[]{ arg1, arg2 }).
  • Import and package statements can appear, and can be interleaved with other declarations and statements. These affect the meaning of names in subsequent references.
  • Variables (and other declarations) can be shadowed by redeclarations.
  • A variable can be declared without an explicit type; the type is inferred.
  • Arbitrary expressions can appear at the top level. If followed by a semicolon, the result of evaluation is not printed.
  • Exceptions are "caught" and printed at the same scope in which they are thrown—the top level—leading to the possibility that some variables might be statically declared but not dynamically initialized. In this case, the standard zero values are used for default initialization.
  • Local methods, analogous to local class declarations, can be declared. All previously-declared names are in scope (if mutual recursion is needed, define the methods in a class declaration instead).
  • All class declarations can contain static members.
  • Wildcards may have both upper and lower bounds (List<? extends Foo super Bar>).
  • Type inference uses an improved algorithm. The expected result type in an invocation's context more frequently influences the result. Union types (Foo | Bar) and the null type may be produced.
  • No accessibility restrictions are enforced.
Some features are not currently implemented, including annotations and inner class declarations (not to be confused with local class declarations). In addition, some standard static error checks, listed below, do not occur. These checks may be implemented in the future.
  • No static warnings occur.
  • Variables may be uninitialized when they are first referenced. In this case, the standard initial zero values are used.
  • A method might complete without returning. Again, the standard initial zero value is used as the result.
  • Certain code might be unreachable in a method body.
  • An exception that is declared to be thrown may never occur.
  • Illegal method overloadings may occur, and an inherited abstract method might not be implemented.
Finally, the interpreter's tight integration with a real JVM exposes certain implementation details. Some implementation classes are visible to the user. Code that depends on the caller (such as Class.forName(String) and stack traces) may not behave as expected. Reflection can be used to inspect the internals of locally-defined classes, which vary somewhat from the JDK's implementation (although such details are not part of the standard).

Why can't I create a subclass of my non-public class in the Interactions Pane?

If a class is not public, you will not be able to extend it with a subclass in the Interactions Pane. This is partially an issue with DynamicJava, the interpreter we use for the Interactions Pane. In general, package-private classes are only accessible to classes in the same package. Usually, all classes without a package statement are considered to be part of the same package, but DynamicJava does not recognize this and will not let you extend such a class.

Workaround: A simple alternative is to make the intended superclass public. Of course, defining your subclass in the Definitions Pane and compiling it will also work.

Why can't I talk about certain fields in the debugger?

Because of the way Java classes are compiled, our debugger is unable to find some fields and variables in the Interactions Pane or Watches tab in certain contexts. Currently, the debugger has the following limitations:

  • You cannot access final variables or fields which have been inlined by the compiler.
  • Inside an inner class, you cannot access local variables from an outer class if they are not used in the inner class.
  • Inside an anonymous class or an inner class of an anonymous class, you cannot access static fields or methods from an outer class.
  • In the first line of the constructor of an instance inner class, you cannot access fields of an outer class.
  • Some private or protected fields may not be accessible.

How can I interact with Applets in DrJava?

Williams College has developed a library known as ObjectDraw which allows users to easily display and run Java Applets outside of a web browser. The ObjectDraw library can be downloaded as a Jar from (You may need to right-click on the above link to choose the "Save Link Target As..." option in your web browser.) You can then add the objectdraw.jar file to DrJava's Extra Classpath option in the Preferences window to make it available within DrJava.

For example, suppose you have written an Applet class named MyApplet. After compiling it, enter the following lines in the Interactions Pane to run the Applet:

Note: There appears to be a bug in ObjectDraw in which it does not call the applet's init() method before running it. A workaround is to call the init() method manually before creating the AppletFrame.

import objectdraw.AppletFrame;
MyApplet applet = new MyApplet();
int width = 300;
int height = 300;
AppletFrame frame = new AppletFrame("MyApplet's Title", applet, width, height);

How can I use AP's Marine Biology Case Study in DrJava?

The College Board has developed a Marine Biology Simulation Case Study for the Advanced Placement (AP) Computer Science curriculum. Instructions for using this case study can be found on the AP® CS Case Study page.

Note: If you are interested, you can download the source code for the classes contained in the MBS jar files from (The source files are linked at the bottom of the page.) This is not necessary for using the simulation.

Can I run DrJava with Java 1.3 or 1.4?

Java 1.3 and 1.4.2 are no longer supported, and DrJava is compiled to require Java 5 or later. However, you can use an older version of DrJava. drjava-stable-20040326 was the last stable release to support Java 1.3. drjava-stable-20080828-r4664 was the last stable release to support Java 1.4.2.

Can I run DrJava on Windows 95?

Yes, but we don't recommend it, because Windows 95 is quite old and few updates are available for it. If you have an older computer, you also may not have enough resources to effectively run DrJava. We recommend at least 64 MB of RAM.

To run DrJava on Windows 95, you must install Java 1.3.1, as described by Sun here. You will need an older version of DrJava (such as drjava-stable-20040326) that supports Java 1.3. You must also install TCP/IP support for Windows 95, since DrJava uses the Java RMI library to communicate between its two local Java Virtual Machines (JVMs). (DrJava does not communicate over the network; it has one JVM for the main program and one JVM for the Interactions Pane.) Instructions for installing TCP/IP support for Windows 95 can be found here.

Can I run DrJava on OS X version 10.1?

Yes. However, Java 1.4 is not available for OS X 10.1, so you will need an older version of DrJava (such as drjava-stable-20040326).

Can I run DrJava on OS X version 10.2 or 10.3?

Yes. However, you will not be able to take advantage of any Java 5.0 features, because Apple has only released Java 5.0 for OS X versions 10.4 and later. If support for generics is needed, you might try using the JSR-14 compiler with an older version of DrJava, as described below.

Why won't DrJava run on my G5 PowerMac?

The version of Java shipped with some PowerMacs is not compatible with DrJava. This can be easily fixed by installing at least the Apple JDK 1.4.1 Update 1.

Why does Windows XP crash when running DrJava in JDK 1.4.1?

This is not a DrJava-specific problem. There is a known issue with JDK 1.4.1 and some video cards in Windows XP, likely caused by DirectX and an ATI Radeon video driver. For more information, see here. As a workaround, completely uninstall JDK 1.4.1 and install either JDK 1.4.0 or 1.4.2.

Why does the Definitions Pane lose focus in JDK 1.4.1 on Windows or Linux?

In JDK 1.4.1, many commands (such as creating a new document) cause the Definitions Pane to lose focus. This appears to be a bug in Sun's JDK 1.4.1, rather than in DrJava. As a workaround, install either JDK 1.4.2 or JDK 1.4.0.

Why do I get an ArrayIndexOutOfBoundsException whenever I try to open a file on OS X 10.2?

This is a known problem with Apple's implementation of the file chooser (displayed when opening, saving, etc.) under OS X version 10.2 and Java 1.4.1. The libraries DrJava uses when displaying the file chooser contain a bug. See SourceForge bug #992525 for details.

Workaround: If upgrading the Java installation or the operating system is not an option, you can deactivate the Apple GUI by selecting a different look and feel. Go to the "Preferences" dialog (in the "Edit" menu), select "Display Options," and under "Look and Feel" select something besides "apple.laf.AquaLookAndFeel". When you restart DrJava, the GUI should look different, and you should no longer experience the bug.

How do I use the JSR-14 compiler in DrJava?

Before Java 5.0 was released, DrJava provided support for Sun's prototype compiler that supported generics, known as JSR-14. This support is no longer available in DrJava, but you can download an older version (such as drjava-stable-20040326) if it is needed.

To use JSR-14 in DrJava, you will first need to download it from Sun's Java Developer Connection site. (Note that this requires creating a free user account.) Once you have downloaded the package, open the older DrJava application, select the Preferences window (from the Edit menu) and specify the locations of the JSR-14 versions of javac.jar and collect.jar, which were included in the package you downloaded. JSR-14 should now appear in the list of available compilers on the Compiler Output tab.

Note on Requirements: The newer versions of JSR-14 (versions 1.3 and later) require a JDK version 1.4.1 or later. Version 1.2 of JSR-14 requires JDK 1.4, while version 1.0 will work with JDK 1.3.1.

Hosted by DrJava has been partially funded by the National Science Foundation, the Texas Advanced Technology Program, and Sun Microsystems, Inc.