I recently downloaded the antlr-4.1-complete.jar files and I'm using the "The Definitive ANTLR4 Reference" book to learn it (as I have never used ANTLR before). However I ran into an error message and I can't figure out how to fix it. In section 1.2 "Executing ANTLR and Testing Recognizers" I was trying to use the runtime library called "TestRig" but when I tried to execute "java org.antlr.v4.runtime.misc.TestRig" at the command prompt I get the following error message "Error: Could not find or load main class org.antlr.v4.Tool"
The following are the directories that I'm using right now:
Java: C:\Program Files (x86)\Java\jre7\bin
ANTLR Jar: C:\Users\Dominick\Desktop\Programming\ANTLR\Binaries
Hello.g4: C:\Users\Dominick\Desktop\Programming\Grammars\Hello
I've tried executing the command while the current directory was the "Binaries" and "Hello" directories but I get the same error message. I also set up a shortcut to the command prompt to run a script when it starts to set up some aliases, specifically:
DOSKEY grammars=cd C:\Users\Dominick\Desktop\Programming\ANTLR\Grammars\$1
DOSKEY antlr=java -jar C:\Users\Dominick\Desktop\Programming\ANTLR\Binaries\antlr-4.1-complete.jar $1
I suspect the problem is related to the CLASSPATH and/or PATH variables, but I'm not complete sure how to set these up. Under Environment Variables, the following are present:
User Variables
CLASSPATH:
C:\Program Files (x86)\Java\jre7\bin\ (I manually added this)
PATH:
C:\Program Files (x86)\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Tools\Sandcastle\ProductionTools\
C:\Program Files (x86)\Java\jre7\bin\ (I manually added this)
System Variables
CLASSPATH:
C:\Program Files (x86)\Java\jre7\bin\ (I manually added this)
Path:
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;
C:\Program Files\Microsoft\Web Platform Installer\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SDKs\TypeScript\;
C:\PROGRA~1\CONDUS~1\DISKEE~1\;
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
C:\Program Files (x86)\Java\jre7\bin\ (I manually added this)
Everything else seems to working so far. For example, if I type the following two commands:
grammars Hello
antlr Hello.g4
The current directory will change to C:\Users\Dominick\Desktop\Programming\ANTLR\Grammars\Hello (where I have my Hello test grammar) and all the files it's suppose to create are created (e.g. Hello.tokens, HelloLexer.java, HelloListener.java, etc.). I just can't get the "TestRig" tool to run.
Thanks in advanced for any help with this. I really don't want to continue with the book until I can get this working since I assume I'm going to need to use this later on.
~Dominick