meta data for this page
This is an old revision of the document!
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 following two files:
https://javacc.com/download/javacc.jar https://javacc.com/download/freemarker.jar
Put both files in the same directory somewhere and then the tool should be runnable via:
java -jar <wherever-you-downloaded-thefiles>/javacc.jar <MyGrammar.javacc>
That’s all, folks! The freemarker.jar must be in the same directory as the javacc.jar. Aside from that, there are no other dependencies. 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:
- JDK (1.8 or higher)
- Git
- Apache Ant
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:
ant test
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.
Eclipse
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.
IntelliJ
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.