3
votes

So, here's my problem. I've got my ANTLR4 code successfully compiled, without errors and now I want to test it out. The ANTLR4 Documentation tells me, to test my applications, I shall do this:

java org.antlr.v4.runtime.misc.TestRig

I've tried this and got following error:

Error: Main Class org.antlr.v4.runtime.misc.TestRig couldn't be found or load.

I've checked if my CLASSPATH wasn't set, but everything was correctly set as it should be. I also tried moving the file directly to my test folder and opened CMD there and tried it again, I occur the same error. Searching in the Internet didn't help, as no one seemed to have occurred this error with ANTLR4 before.

Specs:

Java 1.7.0.55

ANTLR 4.4

1
Can you add the complete stacktrace please.Jens
@Jens There's no stacktrace. It just showed that the main class couldn't be found or load. If it's somehow possible to dump it, then please tell me and I do.Zuka
I have exactly the same problem.Devid

1 Answers

6
votes

There seems to be something wrong with your classpath, contrary to your belief everything is okay.

When I download the ANTLR 4 JAR and run TestRig:

wget http://www.antlr.org/download/antlr-4.4-complete.jar
...
java -cp antlr-4.4-complete.jar org.antlr.v4.runtime.misc.TestRig

I see the following on my console:

java org.antlr.v4.runtime.misc.TestRig GrammarName startRuleName
  [-tokens] [-tree] [-gui] [-ps file.ps] [-encoding encodingname]
  [-trace] [-diagnostics] [-SLL]
  [input-filename(s)]
Use startRuleName='tokens' if GrammarName is a lexer grammar.
Omitting input-filename makes rig read from stdin.