Back to distribution page


A Generic Java Language Extension

Compiler Installation

GJ is implemented on top of the Java Development Kit (other Java-compatible virtual machines will also work). The GJ compiler gjc is a straight replacement for Sun's Java compiler javac. When compiling .java files, gjc works just like javac, except that it's up to 2 times faster for large sources.

This page describes the procedure for downloading and installing GJ for UNIX and Windows '95 systems in six easy steps. If you know something about Java, you can also install GJ on any other conforming Java system by proceeding analogously to what's described here.

We recommend that you also subscribe to the Pizza mailing lists, which notify you of updates to this distribution and provide answers to questions relating to GJ and Pizza.

  1. Get the Java Development Kit, in case you don't have it already. You'll need to have JDK 1.1, or JDK 1.2 beta 4 or higher.

  2. Get the GJ distribution, as indicated on the distribution page.

  3. Pick a directory for unpacking and unpack the distribution into it. This will create a gj directory with three subdirectories classes, src and doc.

  4. Include the gj/classes subdirectory in your CLASSPATH. Alternatively, move the gj/classes directory into some other directory on your CLASSPATH. In case the CLASSPATH environment variable is not yet defined you need to set it now.

    You should now have a directory, say `X', in your CLASSPATH such that

    exists. Make sure that this is the case.

  5. On UNIX systems, set an alias (csh syntax used here).

      alias gjc java -ms12m gjc.Main
    On Windows systems, you can use the file gjc.BAT, which is part of the distrution. Be sure to put this file into a directory which is in your executable path. The file gjc.BAT contains the following single line.
      java -ms12m gjc.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
    The option -ms12m sets the initial heapsize of the Java interpreter to 12MB, the recommended size for GJ. Depending on your system, you might want to choose a different size.

  6. You can now invoke the GJ compiler with the command

      gjc options
    Simply typing gjc will give you a list of all available options. Source files should have extension .java.

  7. Options you plan to use all the time may be included in the alias or .BAT file. One commonly defines a fixed output directory for compiled classes with

      -d directoryname
    The output directory should be listed in your CLASSPATH. Frequently the output directory will be the one that also contains the gjc directory.

  8. The GJ release includes a retrofitted version of the collection classes, in package java.util. Since this package is part of the standard Java system, it is loaded before classes listed in the classpath. To properly access the retrofitted files, use the bootclasspath flag.

    On UNIX systems, set an alias (csh syntax used here).

      alias gjcr java -ms12m gjc.Main -bootclasspath ~/gj/classes/;~/jdk1.2/jre/lib/rt.jar;~/jdk1.2/jre/lib/i18n.jar
    On Windows systems, use a file gjcr.BAT, containing the following single line.
      java -ms12m gjc.Main -bootclasspath c:\gj\classes\;c:\jdk1.2\jre\lib\rt.jar;c:\jdk1.2\jre\lib\i18n.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
    Here ~/gj or c:\gj is the GJ directory, and ~/jdk1.2 or c:\jdk1.2 is the JDK 1.2 directory, change these as appropriate to your installation.

    You can now invoke the retrofitted GJ compiler with the command

      gjcr options

Back to distribution page

Comments and bug reports to the Pizza Group, Java is a trademark of Sun Microsystems. All software and documents on the Pizza site are © Copyright 1996, 1997 by the respective authors as attributed on each. Terms for redistribution are available.