Setting up Demeter/Java

Copyright Notice

Before downloading the software, please read the copyright notice.

Using Demeter/Java at Northeastern

  1. Add the following line to your ~/.software file:
    PATH=/proj/demsys/demjava/bin
    
  2. Run the resoft command from existing shells in order for this additions to take effect. Use the software -v command to see exactly how your .software file determines your PATH.
  3. Skip ahead to the Verifying your setup section.

Installing Demeter/Java on your system

  1. If necessary, download and install Sun's Java 2 Software Development Kit (SDK) (version 1.2 or later) and Metamata's Java Compiler Compiler (JavaCC) (version 1.0 or later).
  2. Download the latest version of Demeter/Java.
    Note: If your browser tries to open the jar file in the browser window, use the right-click popup menu command "Save Link As..." to save it to disk. This is particularly noticable with Netscape.
  3. Unpack the demjava-<version>.jar file in a convenient directory. Typically it would be your home directory on Unix or Windows NT, or "c:\" on Windows 95. You can either use the jar tool from the JDK, with "jar xvf file" at the command prompt, or you can use any unzip tool, e.g. WinZip.
    Note: Unix users will need to use "chmod a+x" on the shell script in the bin directory, because jar doesn't preserve the executable bit.

    This will result in the following directory structure:

          demjava-<version>
                |_______README
                |_______COPYRIGHT
                |_______rt.jar
                |_______aplib.jar
                |_______dj.jar
                |_______demjava.jar
                |_______bin
                |        |_____demjava.bat
                |        |_____demjava
                |_______src
    
    Do not unpack the .jar files!

    Note: the src directory contains the source code to Demeter/Java; it is provided only for your curiosity. You don't need to compile anything to run it; the .jar files have all the bytecode files you need.

  4. Optional: if you'd like to use the GUI, download the apstudio-<version>.jar file from the ftp directory and unpack it in the same directory as you unpacked demjava-<version>.jar; this will add apstudio.jar and the images subdirectory.
  5. Rename or copy demjava-<version> to demjava, and add the bin directory to your PATH (or copy the batch or script file into a directory that's already on your path). Tip: Windows NT users, use Control Panel->System->Environment. Windows 95 users, edit the autoexec.bat file.
  6. You may need to edit the paths in the demjava.bat batch file or the demjava script file in the bin directory to match your setup.

Verifying your setup

Run these commands to make sure you have the right versions of everything in your PATH:

Testing Demeter/Java

  1. In a new, empty directory, run "demjava new". This will create the project file, program.prj, as well as sample class dictionary, behavior, and test input files, program.cd, program.beh, and program.input, respectively.
  2. Run "demjava test". This should compile and run the test program; if successful, it will print "It works!" at the end.
    Note: Windows users: if you notice the compilation process seems to hang for a long time (usually after JavaCC finishes), you'll need to stop it (with control-C) and run "demjava -eofbug test". It should continue where it left off. We're working on a better solution to this problem.
  3. If you've installed the Java Foundation Classes and the AP Studio files, and edited the demjava.bat batch file or the demjava script file in the bin directory to point to the JFC, then try out AP Studio by running "demjava studio". You can load the sample class dictionary with File->Open, then select program.cd.

The CLASSPATH environment variable

If you always use the demjava front end interface to compile and run your program, you shouldn't need to set your CLASSPATH environment variable. However, if you want to run your code directly (by invoking the VM directly), you'll need to put the Demeter runtime support package into the CLASSPATH; these classes are in the rt.jar file. For example, at Northeastern, you would put this line in your ~/.software file:
CLASSPATH=.:/proj/demsys/demjava/rt.jar
This is also needed if you want to compile Demeter/Java-generated Java files directly.
Doug Orleans <dougo@ccs.neu.edu>
Last modified: Wed Oct 13 23:28:47 EDT 1999