[antlr-interest] (error)Reference to TreeAdaptor and Common Tree are ambiguous.(newbie)

Randall R Schulz rschulz at sonic.net
Sun Jul 15 15:27:34 PDT 2007


On Sunday 15 July 2007 15:15, Randall R Schulz wrote:
> ...
>
> Perhaps you have both the antlr-3.0.jar and the antlr-runtime-3.0.jar
> files in your classpath? The former is for the ANTLR processor, used
> only when transforming your grammar specification to Java code.
> Running that code requires only the antlr-runtime-3.0.jar file.
> Likewise for the antlr.2.7.7.jar (for the moment, ANTLR 3.0 parses
> its specifications using a bootstrapping parser written using antlr
> 2.7) and for stringtemplate-3.0.jar (used for modular source code
> synthesis). Conversely, all the classes in the antlr-runtime-3.0.jar
> are also present in antlr-3.0.jar.

That's perhaps not very clear.

Here it is again, more simply:

To run the ANTLR v3 tool, the class-path must include these JARs:

 .../lib/antlr-2.7.7.jar
 .../lib/antlr-3.0.jar
 .../lib/stringtemplate-3.0.jar


To compile or run parsers generated by ANTLR v3 you need only this JAR:

 .../lib/antlr-runtime-3.0.jar


Every class in antlr-runtime-3.0.jar is duplicated in antlr-3.0.jar. 
Antlr-3.0.jar so one shouldn't ever use them together. The Java virtual 
machine won't care, it will just take the first one found in the 
class-path, but IDEs might be more circumspect and tell you about a 
reference to a class that appears twice in the class-path.


> ...


Randall Schulz


More information about the antlr-interest mailing list