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

Jim Idle jimi at temporal-wave.com
Wed Feb 15 11:25:01 PST 2012


Did you try java -jar antlr-3.4-complete.jar ....

The whole point is that you don't need the classpath. Also, you will get
in to trouble using a relative classpath anyway. I usually wrap this in to
a shell script.

Jim

#! /bin/bash

java -Xmx750M -Xincgc -jar
~/antlrsrc/code/antlr/release-3.4/target/antlr-master-3.4-completejar.jar
-Xconversiontimeout 32000 $

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Adrian Evans
> Sent: Tuesday, February 14, 2012 5:11 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Help With Antlr3.4 on Mac Os X
>
> 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