[antlr-interest] How to call self-build ANTLR correctly?

Randall R Schulz rschulz at sonic.net
Tue Jul 3 14:00:47 PDT 2007


On Tuesday 03 July 2007 13:50, Johannes Luber wrote:
> Terence Parr wrote:
> > you need the bin not bin\org\antlr in your path.  Also add the
> > runtime dir.
>
> I do the following:
>
> D:\>java -cp "D:\Install Files\ANTLR\antlr-source\bin\org\antlr\runtime" "D:\Install Files\ANTLR\antlr-source\bin"\org.antlr.Tool

You're telling Java to run a nonsense class name. There should be no
file path name syntax in the main entry-point class name. It's just
org.antlr.Tool. That is, the last argument in the command line you gave
should simply be org.antlr.Tool. Of course, you'll need to supply other
arguments—at least a grammar source file and any options you choose.

But ANTLR itself requires ANTLR v2.7 in its class path, since the parser
that ANTLR v3 uses to parse ANTLR source is (currently) and ANTLR v2.7
parser. You also need the string template library. Since that source is
distributed separately, I don't suppose it's going to be in the results
produced by bulding ANTLR, but I don't know that for a fact.


> The output:
>
> Exception in thread "main" java.lang.NoClassDefFoundError: D:\Install
> Files\ANTLR\antlr-source\bin\org/antlr/Tool


Randall Schulz


More information about the antlr-interest mailing list