How do I install javacc in Windows 10?
I visited https://javacc.github.io/javacc/, but there's no clear instruction to set it up on Windows.
Update: I have made some changes to the steps, and provided some notes about those changes at the end.
I know the OP switched to using version 6, but here are the instructions for version 7:
(Version 7.0.5, to be precise.)
Go to the "Getting Started" page here.
Download the zip file from the "Source(zip)" link.
Unzip that into a directory of your choosing. I chose a new empty directory E:\javacc
. That ended up giving me everything in E:\javacc\javacc-7.0.5
.
Create a new target
directory. For me, that was E:\javacc\javacc-7.0.5\target
.
NO NEED TO DO THIS: Download the jar file from the "Getting Started" page, using the "Binaries" link. That gives you a file javacc-7.0.5.jar
.
Locate the javacc.jar
file in the bootstrap
directory. Copy that file to the new target
directory.
Add the scripts
directory (for me: E:\javacc\javacc-7.0.5\scripts
) to your PATH
environment variable. I assume that does not need specific instructions.
To test the installation:
Open a new command prompt (to pick up the PATH changes), and navigate to the javacc installation directory (for me: E:\javacc\javacc-7.0.5
).
Execute the following command:
javacc
This should give you a screenful of output, starting with:
E:\javacc\javacc-7.0.5>java -cp target/javacc.jar javacc
Java Compiler Compiler Version 7.0.5 (Parser Generator)
Usage:
javacc option-settings inputfile
Similarly, you should be able to run the jjdoc
and jjtree
commands.
Update
The above steps were, indeed, unnecessarily complicated - as noted in comments. I have made some simplifications (used with v7.0.10). Those are shown above.
The objective when using the JavaCC zip file is to be able to execute each JavaCC command (e.g. javacc
) on the command line directly.
You can run JavaCC commands using only the JAR file, as follows:
java -cp javacc.jar javacc
Using this approach, you will not have access to javacc
(or the other commands) directly on the command line: they will not be on your PATH
.
You can follow the same steps in the Installation part of the guide.
https://javacc.github.io/javacc/#getting-started
After you have unzipped the downloaded file into a new directory, you need to add the path of the folder to your PATH variable in Windows. To do that, follow this guide:
https://www.java.com/en/download/help/path.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With