Greetings! On Tue, 2010-06-08 at 16:44 +0200, Andreas Kumlehn wrote: > Hi all, > I want to develop a configuration file for some tool of mine and > therefore decided to dive into ANTLR. The definitive ANTLR reference > book arrived some days ago and I tried some of the examples from the book's > website. > > To generate the lexer/parser and compiling the Java files the > following commands work without erros: > java -cp ./lib/antlr-3.1.3.jar:./lib/antlr-2.7.7.jar:./lib/ > stringtemplate-3.2.jar org.antlr.Tool Expr.g > javac -cp ./lib/antlr-3.1.3.jar:./lib/antlr-2.7.7.jar:./lib/ > stringtemplate-3.2.jar ExprLexer.java ExprParser.java Test.java > > When I try to run the provided testrig coded in Test.java with command > java -cp ./lib/antlr-3.1.3.jar:./lib/antlr-2.7.7.jar:./lib/ > stringtemplate-3.2.jar Test > results in the following error: > > Exception in thread "main" java.lang.NoClassDefFoundError: Test > Caused by: java.lang.ClassNotFoundException: Test > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > > The commands above are from my Mac, but I tried this on a WinXP > machine, too (with adapted paths). > > Current SDK is installed, everything else works fine. Any suggestions or > hints? > Thanks for helping!
it appears that the current directory (e.g. ./) is not in the class path when you try to execute the Test class include ./ somewhere in your -cp stuff or better yet add the ANTLR stuff to the $CLASSPATH environment variable. -jbb 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.
