[antlr-interest] Help With Antlr3.4 on Mac Os X

Terence Parr parrt at cs.usfca.edu
Tue Feb 14 17:33:51 PST 2012


is dot in your classpath?
Ter
On Feb 14, 2012, at 5:10 PM, Adrian Evans wrote:

> Hello,
> 
> I'm trying to follow the examples from : How do I use ANTLR v3 from the command line. I've installed antlr-3.4 on Mac OS 10.6.8:
> 
> java version "1.6.0_26"
> Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
> Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
> 
> java org.antlr.Tool -version
> ANTLR Parser Generator  Version 3.4
> 
> In the example directory (examples-v3/java/LL-star), I can compile the .g and compile the java - no problem:
> 
> echo $CLASSPATH
> ../../../antlr-3.4/lib/antlr-3.4-complete.jar
> 
> [examples-v3/java/LL-star] % java org.antlr.Tool SimpleC.g
> [examples-v3/java/LL-star] % javac *java
> 
> But when I run - I GET
> 
> [examples-v3/java/LL-star] % java Main input
> Exception in thread "main" java.lang.NoClassDefFoundError: Main
> Caused by: java.lang.ClassNotFoundException: Main
> 	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:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> [examples-v3/java/LL-star] % 
> more Main.java 
> import org.antlr.runtime.*;
> 
> public class Main {
>        public static void main(String[] args) throws Exception {
>                CharStream input = new ANTLRFileStream(args[0]);
>                SimpleCLexer lex = new SimpleCLexer(input);
>                CommonTokenStream tokens = new CommonTokenStream(lex);
>                //System.out.println("tokens="+tokens);
>                SimpleCParser parser = new SimpleCParser(tokens);
>                parser.program();
>        }
> }
> 
> Any tips?
> 
> Thanks!
> 
> AE
> 
> 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