[antlr-interest] problem executing antlr under win XP

Robert Colquhoun rjc at trump.net.au
Mon May 26 16:22:48 PDT 2003


At 10:32 PM 26/05/2003 +0000, Patrik Suzzi wrote:
>Hi, I'm patrik.
>I've got a problem using antlr under windows XP:
>
>I've extracted antlr then moved to directory C:\antlr-2.7.2
>
>Using "properties" on MyComputer I've added an environment variable
>CLASSPATH = C:\antlr-2.7.2/antlr.jar
>
>Following the first sample in documentation I get scanner & parser
>from antlr, But once written and compiled Main.java it does not work.
> >java Main
>Exception in thread "main" java.lang.NoClassDefFoundError: Main

That's because the current directory  "." is not in your classpath.

Basically for 1.2 or later versions of java do *not* set the CLASSPATH 
enviornment variable.  It is much better to just set up the classpath for 
your program only on the command line when invoking it.

ie java -classpath c:\antlr-2.7.2\antlr.jar;. Main

By default with "-classpath" the standard system libraries are included, 
and do not need to be included manually.

Once you have the above working put it in a batchfile, shellscript or 
makefile to make invocation easy.

   - Robert


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list