How to setup and use JavaCC locally.

Java Setup

REMEMBER: You have to run "setup java" or "setup java1.2" before using JavaCC.

JavaCC is installed so that the following line of code will enable you to use the tools contained in the JavaCC package.

setpath /home/java/extensions/JavaCC/bin

For those interested in exactly how this works, you should take a look at the shell scripts contained in the above directory. For an alternative method, and description, read on.

JavaCC is an 100% pure java package. This means that in order to use it you have to set the CLASSPATH environment variable so java knows where to get the relevent classes. The following line alters the CLASSPATH environment variable correctly.(Note: This may move if JavaCC becomes widely used, so if your programs stop working check back here to see where it has moved to.)

export CLASSPATH=/home/java/extensions/JavaCC/:$CLASSPATH

The JavaCC package comes with three different tools, all explained in the package documentation. The following aliases will allow you to use the tools as the documentation specifies.

alias javacc="java COM.sun.labs.javacc.Main"
alias jjtree="java COM.sun.labs.jjtree.Main"
alias jjdoc="java COM.sun.labs.jjdoc.JJDocMain"

How to learn to use the JavaCC tools

The best way to learn how to use the tools included in the JavaCC package is to read the documentation and study the examples mentioned. The examples are located in /home/java/extensions/JavaCC/examples/. You should probably copy the example you wish to work on to your home directory before starting so you can modify it while testing how it works.
Java Support
Last modified: Fri Aug 28 14:27:20 BST 1998