0

I am trying to make unit tests for multiple return values in Antlr. I have regular unit tests working using gunit. However, I am not too sure what to do with the junit Testgrammar.java file that is generated as per the instructions at http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing

I've tried running:

java -cp "./antlr.jar" Testgrammar.java

but I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: Testgrammar/java

Mark
  • 3,177
  • 4
  • 26
  • 37

2 Answers2

1

You run it like any other Java app: with the classname, not the file name.

java -cp "./antlr.jar" Testgrammar
Jorn
  • 20,612
  • 18
  • 79
  • 126
  • it has something to do with running it with junit. I am just not that familiar with setting it up from the command line. – Mark Dec 13 '09 at 00:33
  • Not sure about running with JUnit, just spotted the error in your command line call there – Jorn Dec 13 '09 at 00:57
0

It needs to be compiled linking to the build output of the grammar files and then run with:

java org/junit/runner/JUnitCore Testgrammar

Mark
  • 3,177
  • 4
  • 26
  • 37