简体   繁体   中英

Why is JavaCC not working on my mac and how can I fix it?

I want to test my programme, so I have downloaded JavaCC 5.0, as 6.0 has issues. I have copied /bin to usr/local/bin but now when I input javacc MyTest.jj into terminal I get the following error.
Error: Could not find or load main class javacc
I've looked around to see why this error occurs, and the only thing I have found relating to this is this question
Could not load main class in JavaCC
As I am using an older version of JavaCC, there should be no issue with the PATH. Also, while trying to find a cause for this error, I have found that it only seems to occur if the input in terminal is java class so why is it happening? What can I do to get Javacc working?

Your file structure should look like this where .../bin is some directory on your unix path

.../bin/
         javacc
         jjrun
         jjtree
         lib/
             javacc.jar

Of course the three jj* files should be executable.

In a terminal enter which javacc . Presumably the answer will be /usr/local/bin . Look for a directory called /usr/local/bin/lib . If it's not there, create it. It should contain a file named javacc.jar . If not, find the javacc.jar file you downloaded and place it in this directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM