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

Adrian Evans citizen.adrian.1 at gmail.com
Tue Feb 14 17:10:50 PST 2012


 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:


[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);
                SimpleCParser parser = new SimpleCParser(tokens);

Any tips?



More information about the antlr-interest mailing list