Getting started with JavaCC
The version of JavaCC 6.0 that I downloaded today (2013.07.22) did not have a complete bin directory. It was missing all the script files! Hopefully this will be remedied soon.
For OS X and other unix/linux variants, the missing script file is called javacc, should be executable, and should contain the following:
#!/bin/sh
JAR="`dirname $0`/lib/javacc.jar"
case "`uname`" in
CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;;
esac
java -classpath "$JAR" javacc "$@"
Add the bin directory to your PATH (omitting the backslash -- as pointed out by Ahmed Masud) and all should be ticketty boo. If your OS comes from Redmond or you want to run jjtree or jjdoc, just download javacc-5.0 and copy the script files (NOT the lib directory!!!!) from the 5.0 bin directory to the 6.0 bin directory.
Update (2020): Since version 6 is now harder to find, I have put a copy at www.engr.mun.ca/~theo/JavaCC/javacc-6.1.0.zip
In Windows, I also had no javacc and have to use
java -cp bin\lib\javacc.jar javacc
instead. This is very frustrating because all docs propose to use javacc
, which we miss. Yet, I see that javacc
was defined in the old javacc 5.0. I see javacc.bat
there
java -classpath "%~dp0lib\javacc.jar;%~dp0lib\javacc.jar;%~f0\..\lib\javacc.jar" javacc %1 %2 %3 %4 %5 %6 %7 %8 %9
more javacc
:
#!/bin/sh JAR="`dirname $0`/lib/javacc.jar"
case "`uname`" in
CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;; esac
java -classpath "$JAR" javacc "$@"
more jjtree
:
#!/bin/sh JAR="`dirname $0`/lib/javacc.jar"
case "`uname`" in
CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;; esac
java -classpath "$JAR" jjtree "$@"
Create these scripts in the bin
folder of your javacc-6.0/bin
.
make a chmod :
chmod 755 javacc
chmod 755 jjtree