Building ANTLR4 4.2.3 with Maven. Can't load Hello as lexer or parser.

498 views
Skip to first unread message

jonathan...@gmail.com

unread,
May 23, 2014, 1:42:35 PM5/23/14
to antlr-di...@googlegroups.com

I need to work with Java 8 grammar so I wanted to tool around with the current ANTLR source.

I followed the instructions here for building ANTLR with Maven and attached the jar I built:
https://theantlrguy.atlassian.net/wiki/display/ANTLR4/Building+ANTLR+4+with+Maven

I just wanted to run the Hello example as a sanity check:
https://github.com/antlr/antlr4

Here are the of the steps I took to run the example:
mack@orca:~/Documents/antlr$ alias antlr4='java -jar /home/mack/Documents/git/antlr4/tool/target/antlr4-4.2.3-SNAPSHOT-complete.jar'
mack@orca:~/Documents/antlr$ alias grun='java org.antlr.v4.runtime.misc.TestRig'
mack@orca:~/Documents/antlr$ export CLASSPATH="/home/mack/Documents/git/antlr4/tool/target/antlr4-4.2.3-SNAPSHOT-complete.jar"
mack@orca:~/Documents/antlr$ antlr4 Hello.g4
mack@orca:~/Documents/antlr$ javac Hello*.java
mack@orca:~/Documents/antlr$ grun Hello r -tree
Can't load Hello as lexer or parser


mack@orca:~/Documents/antlr$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
mack@orca:~/Documents/antlr$ javac -version
javac 1.8.0_05


I can run the same example with the ANTLR 4.2.2 pre-built version with no problems:
http://www.antlr.org/download/antlr-4.2.2-complete.jar

Any advice would be immensely helpful.

Thanks,
Jon

antlr4-4.2.3-SNAPSHOT-complete.jar

Terence Parr

unread,
May 23, 2014, 2:02:51 PM5/23/14
to antlr-di...@googlegroups.com
was the doc not clear about the classpath needing dot in it?
T


--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dictation in use. Please excuse homophones, malapropisms, and nonsense. 

jonathan...@gmail.com

unread,
May 23, 2014, 2:17:08 PM5/23/14
to antlr-di...@googlegroups.com
Hi Terence,

Sorry I forgot to mention that part. According documentation in numerous places, the classpath step should be more like:

export CLASSPATH=".:/home/mack/Documents/git/antlr4/tool/target/antlr4-4.2.3-SNAPSHOT-complete.jar:$CLASSPATH"

I tried this, but the
grun Hello r -tree

step just hangs forever if I use that classpath.

Sorry I am completely new at this. Any direction is greatly appreciated.

Best,
Jon

Terence Parr

unread,
May 23, 2014, 2:17:54 PM5/23/14
to antlr-di...@googlegroups.com
have you used the command line before? standard input requires you to type input and then hit ctrl-d on mac/linux and ctrl-z on windows for eof.
T
Reply all
Reply to author
Forward
0 new messages