[antlr-interest] jar file changes in version 3.3?
Bart Kiers
bkiers at gmail.com
Sun Dec 5 02:38:04 PST 2010
On Sun, Dec 5, 2010 at 11:21 AM, Chao Wang <chaowang05 at gmail.com> wrote:
> here is the stack trace:
>
> localhost:output mac$ javac TLexer.java TParser.java Test.java
> Test.java:8: cannot find symbol
> symbol : constructor ANTLRFileStream(java.io.InputStream)
> location: class org.antlr.runtime.ANTLRFileStream
> TLexer lex = new TLexer(new ANTLRFileStream(System.in));
> ^
> Test.java:11: cannot find symbol
> symbol : constructor
> TParser(org.antlr.runtime.CommonTokenStream,int,<nulltype>)
> location: class TParser
> TParser g = new TParser(tokens, 49100, null);
> ^
> 2 errors
>
>
The compiler can't find the .class file for the ANTLR runtime. Try:
$ java -cp antlr-3.2.jar org.antlr.Tool T.g
$ javac -cp antlr-3.2.jar *.java
$ java -cp .:antlr-3.2.jar Main
instead.
I tested it with ANTLR 3.2 (the site is down so couldn't download 3.3) with
the following class:
import org.antlr.runtime.*;
public class Main {
public static void main(String[] args) throws Exception {
ANTLRStringStream in = new ANTLRStringStream("call f;");
TLexer lexer = new TLexer(in);
CommonTokenStream tokens = new CommonTokenStream(lexer);
TParser parser = new TParser(tokens);
parser.r();
}
}
Bart.
More information about the antlr-interest
mailing list