Centos 6/RHEL install Dr Java

Dr Java is an interactive testing environment for java actually written in java and run on Linux by invoking the jar module. It is designed primarily for students, providing an intuitive interface and the ability to interactively evaluate Java code. It also includes powerful features for more advanced users so many pros find it useful in a similar manner to the BlueJ ide. Additionally, it can be customized and then a new version (jar file) of the customized app can be generated for subsequent use.

It is easy to use on a Centos 6/RHEL box as long as you have the Sun Java JDK installed, so first make sure that you have by following the link and the instructions.(You might want to install Eclipse while you are there as it is very easy to do, there is also a Dr Java plugin for Eclipse, see below)

There is also a Dr Java available from Princeton University and this is the one we will try first. This sets up a working environment for projects with the Princeton version of DrJava. 

Princeton version

Make a java projects directory

$ mkdir introcs

$ cd introcs

$ mkdir bin

Download and chmod the drjava files

$ wget http://introcs.cs.princeton.edu/java/linux/drjava.jar
$ wget http://introcs.cs.princeton.edu/java/linux/drjava
$ chmod 700 drjava
$ mv  drjava bin

Download the textbok standard library stdlib.jar

$ wget http://introcs.cs.princeton.edu/java/stdlib/stdlib.jar

Download Checkstyle 5.5 and Findbugs 2.0.1 from checkstyle.zip and findbugs.zip to ~/javaproj & download the checkstyle and findbugs execution scripts from checkstyle.sh and findbugs.sh to ~/javaproj/bin and chmod them executable

$ wget http://introcs.cs.princeton.edu/java/linux/checkstyle.zip
$ wget http://introcs.cs.princeton.edu/java/linux/findbugs.zip
$ unzip checkstyle.zip
$ unzip findbugs.zip
$ wget http://introcs.cs.princeton.edu/java/linux/checkstyle.xml
$ wget http://introcs.cs.princeton.edu/java/linux/findbugs.xml
$ wget http://introcs.cs.princeton.edu/java/linux/checkstyle
$ wget http://introcs.cs.princeton.edu/java/linux/findbugs

$ mv checkstyle findbugs bin
$ mv checkstyle.xml checkstyle-5.5
$ mv findbugs.xml findbugs-2.0.1

Add the standard libraries to the CLASSPATH environment variable and add checkstyle and findbugs to your PATH environment variable.

Download config.sh to ~/javaproj/bin

$ wget http://introcs.cs.princeton.edu/java/linux/config.sh
$ mv config.sh bin

Add the following line to the end of either ~/.bash_profile or ~/.profile depending on which you have.

test -r ~/introcs/bin/config.sh && source ~/introcs/bin/config.sh

Now you can run Dr Java with


For introductory tutorials on Java you can go to Princeton University online, where you will also find the above instructions repeated. 

Standalone version

If you just want a standalone DrJava go to http://www.drjava.org/ and download the latest version of Dr Java, you will need to get the Jar file as we will be running it using the jar module
contained within the JDK.

If you have installed Eclipse along with the Java JDK then you may want to get the plug-in for it also at the same time.

Download to your home directory.

Rename it to something easier to type such as 'drjava'

$ mv drjava-stable-20120818-r5686.jar drjava.jar

Now open up a terminal and type

$ java -jar drjava.jar

This will launch Dr Java as below.

Dr Java

Dr Java Interactive Window

You can add the command to the Fluxbox keys file if using Fluxbox.

Fluxbox users see Fluxbox key bindings for more information.

Eclipse Plugin.

If you are installing the Eclipse plugin and have downloaded it, then first you need to unzip it.

$unzip drjava-eclipse-20090115-r4708.zip

Now copy the unzipped jar file into the Eclipse plugins directory

$ cp edu.rice.cs.drjava_0.9.9.20090115-r4708.jar /opt/eclipse/plugins/edu.rice.cs.drjava_0.9.9.20090115-r4708.jar

(Change the Eclipse path to suit your installation)

Now fire up Eclipse and go to Window ->Open Perspective ->Other and you will see an option for 'Dr Java', check this and the view as below should appear, with the Dr Java Interactive pane at the bottom.

Eclipse Dr Java view.

That is all there is to installing the Dr Java plugin in Eclipse.

Labels: , , ,