JavaCC 21 is based on the idea that things should just work. If all you want to do is use the tool, all you need to do is download the file:
There are no dependencies (aside from a JDK) and it should be runnable via:
java -jar javacc-full.jar <MyGrammar.javacc>
That’s all, folks! The above command-line should work on PC, Mac, or Linux.
The rest of the page is for the small minority of people who want to hack the code. The most basic requirements are:
You should be able to check out and build the code like so:
git clone https://github.com/javacc21/javacc21.git cd javacc21 ant
There is a test suite of sorts that you can run with:
If the above is all successful, in principle, you are able to hack the code. None of this should require any tinkering with any environment variables such as CLASSPATH.
Now, of course, most people will want to get the code into an IDE, such as Eclipse or IntelliJ. As of this writing, it should be possible to open the base directory as a project in either one of those.
In Eclipse, it is just
File→'Open Projects from File System and then you click on
Directory and choose the directory in which you checked out the project. Then press
Finish. After a pause, it will tell you in the “Problems” view that you have something over 900 errors. This is because the parser component needs to be generated. (JavaCC is used to build itself.) Once you run:
Project→Build All the errors should disappear and you now have the project in Eclipse.
In IntelliJ, you can also directly open the base directory as a project. You can simply do:
Build→Build Project (Ctrl-F9 is the default shortcut) and it should just build everything.
If you have any issues or suggestions about this topic (or any other), please go to the Discourse discussion forum.