'How to setup Javacc in windows 10 [closed]
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.
Solution 1:[1]
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.)
Set-Up:
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 inE:\javacc\javacc-7.0.5
.Create a new
target
directory. For me, that wasE:\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 thebootstrap
directory. Copy that file to the newtarget
directory.Add the
scripts
directory (for me:E:\javacc\javacc-7.0.5\scripts
) to yourPATH
environment variable. I assume that does not need specific instructions.
Verify:
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
.
Solution 2:[2]
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:
Solution 3:[3]
If you are using Eclipse as your IDE, you can install JavaCC from the marketplace. Just go to help
, then click on Eclipse Marketplace
and when it loads just type "JavaCC" on the search bar and install the plugin. I'm not sure if it's the latest version, but it works well and it's simpler to install.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Bruno Gava Guerra |
Solution 3 | Juan RamÃrez |