It looks like you are expecting your files to be in the package "test". I would remove the line "package test;" from your grammar. Alternatively, you could make a directory "test", and move all the files that expect to be in the package "test" into the test directory.
On Fri, Feb 13, 2009 at 11:39 PM, Raymond J. Schneider <[email protected]> wrote: > Doesn't work: (I've tried that! although it seems to reduce the number of > errors. I included the folder's directory if that helps at all) > Directory of I:\E > > 02/13/2009 09:55 PM <DIR> . > 02/13/2009 09:55 PM <DIR> .. > 01/28/2009 01:38 PM 2,239,854 antlrworks-1.2.2.jar > 02/13/2009 09:41 PM 1,164 Expr.g > 10/28/2008 05:08 PM 116,205 antlr-3.1.1-runtime.jar > 02/13/2009 10:46 PM 13,618 ExprParser.java > 02/13/2009 10:46 PM 132 Expr.tokens > 02/13/2009 10:46 PM 13,082 ExprLexer.java > 02/13/2009 10:55 PM 382 Test.java > 7 File(s) 2,384,437 bytes > 2 Dir(s) 3,649,765,376 bytes free > > I:\E>javac -classpath .;antlrworks-1.2.2.jar Test.java ExprLexer.java > ExprParser > .java > .\ExprLexer.java:9: duplicate class: test.ExprLexer > public class ExprLexer extends Lexer { > ^ > Test.java:6: cannot access ExprLexer > bad class file: .\ExprLexer.java > file does not contain class ExprLexer > Please remove or make sure it appears in the correct subdirectory of the > classpa > th. > ExprLexer lexer = new ExprLexer(input); > ^ > 2 errors > -- > Ray Schneider,PE, Ph.D > Associate Professor > Math and Computer Science > Bridgewater College > http://www.bridgewater.edu/~rschneid/ > http://theweedlessgarden.blogspot.com > ________________________________________ > From: Robert Soule [[email protected]] > Sent: Friday, February 13, 2009 23:22 > To: Raymond J. Schneider > Cc: [email protected] > Subject: Re: [antlr-interest] Ultimately Frustrated > > Hi Raymond, > > Try adding "." to your classpath, to include the current directory. > > javac -classpath .:antlrworks-1.2.2.jar Test.java ExprLexer.java > ExprParser.java > > -Robert > > On Fri, Feb 13, 2009 at 11:10 PM, Raymond J. Schneider > <[email protected]> wrote: >> I'm really frustrated with what must be a trivial problem but I seem to be >> chasing my tail. >> To try to isolate things I put the antlrworks-1.2.2.jar file in a folder >> with Expr.g >> I ran:> java -cp antlrworks-1.2.2.jar org.antlr.Tool Expr.g >> That generated ExprLexer.java, ExprParser.java, and Expr.tokens >> So I added to the directory the Test Harness Test.java with the code: >> >> --- >> import org.antlr.runtime.*; >> >> public class Test { >> public static void main(String[] args) throws Exception { >> ANTLRInputStream input = new ANTLRInputStream(System.in); >> ExprLexer lexer = new ExprLexer(input); >> CommonTokenStream tokens = new CommonTokenStream(lexer); >> ExprParser parser = new ExprParser(tokens); >> parser.prog(); >> } >> } >> --- >> Then I tried to compile it with: >>>javac -cp antlrworks-1.2.2.jar Test.java ExprLexer.java ExprParser.java >> >> All the documentation seems to indicate this should work but what I get is: >> I:\E>javac -classpath antlrworks-1.2.2.jar Test.java ExprLexer.java >> ExprParser.java >> Test.java:6: cannot find symbol >> symbol : class ExprLexer >> location: class Test >> ExprLexer lexer = new ExprLexer(input); >> ^ >> Test.java:6: cannot find symbol >> symbol : class ExprLexer >> location: class Test >> ExprLexer lexer = new ExprLexer(input); >> ^ >> Test.java:8: cannot find symbol >> symbol : class ExprParser >> location: class Test >> ExprParser parser = new ExprParser(tokens); >> ^ >> Test.java:8: cannot find symbol >> symbol : class ExprParser >> location: class Test >> ExprParser parser = new ExprParser(tokens); >> ^ >> Note: ExprParser.java uses unchecked or unsafe operations. >> Note: Recompile with -Xlint:unchecked for details. >> 4 errors >> >> All the .java files are in the same directory >> Probably some old hand can look at this as identify my error, but I >> certainly can't seem to. >> I'd appreciate any help. >> I can run Expr.g in ANTLRWorks directly but not from the command line. >> >> Regards, Ray >> -- >> Ray Schneider,PE, Ph.D >> Associate Professor >> Math and Computer Science >> Bridgewater College >> http://www.bridgewater.edu/~rschneid/ >> http://theweedlessgarden.blogspot.com >> >> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest >> Unsubscribe: >> http://www.antlr.org/mailman/options/antlr-interest/your-email-address >> > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
