[antlr-interest] Fwd: ClassNotFoundException for ANTLRInputStream

Christian (VuuRWerK) Seifert vuurwerk.christian at googlemail.com
Thu Jul 8 12:07:25 PDT 2010


Sorry, I've forgot to send the reply to the list ...


---------- Forwarded message ----------
From: Christian (VuuRWerK) Seifert <vuurwerk.christian at googlemail.com>
Date: 2010/7/8
Subject: Re: [antlr-interest] ClassNotFoundException for ANTLRInputStream
To: Borneq <a.moderacja at gmail.com>


Hi Borneq,

do you have add the path to the antlr-3.2.jar to your class path when
you start the program?
e.g.: java -classpath /path/to/antlr-3.2.jar tld.domain.MainClass
MainClass.class

- Christian

2010/7/8 Borneq <a.moderacja at gmail.com>:
> I compile my first grammar
>
> grammar T;
> /** Match things like "call foo;" */
> r : 'call' ID ';' {System.out.println("invoke "+$ID.text);} ;
> ID: 'a'..'z' + ;
> WS: (' ' |'\n' |'\r' )+ {$channel=HIDDEN;} ; // ignore whitespace
>
> and compiler creates files TLexer.java and TParser.java
> I wrote Test.java :
> ======================================================
> import org.antlr.runtime.* ;
>
>  public class Test      {
>   public static void main(String[] args)   throws Exception{
>       //create a CharStream that reads from standard input;
>           ANTLRInputStream input = new ANTLRInputStream(System.in);
>       //create a lexer that feeds off of input CharStream
>       TLexer lexer = new TLexer(input);
>       //create a buffer of tokens pulled from the lexer
>       CommonTokenStream tokens = new CommonTokenStream(lexer);
>       // create a parser that feeds off the tokens buffer
>       TParser parser = new TParser(tokens);
>       //  begin   parsing   at  rule  r
>       parser.r();
>  }
> }
> ======================================================
> When I debug, it appear exception in "ANTLRInputStream input = new
> ANTLRInputStream(System.in);"
> Exception is ClassNotFoundException org.antlr.runtime.ANTLRInputStream
> It compiles but runtime error, what I have bad in project?
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list