GreenClover
GreenClover

Reputation: 23

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?

Upvotes: 2

Views: 1558

Answers (1)

Theodore Norvell
Theodore Norvell

Reputation: 16231

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.

Upvotes: 3

Related Questions