From the Definitive ANTLR4 reference I have run through the first example and it has generated the JAVA target. In the directory C:JavaLib I have antlr-4.5-complete.jar
When I attempt to compile it with;
javac -classpath C:JavaLib *.java
It creates the following error messages;
helloBaseListener.java:13: error: class HelloBaseListener is public, should be declared in a file named HelloBaseListener.java
public class HelloBaseListener implements HelloListener {
^
helloListener.java:9: error: class HelloListener is public, should be declared in a file named HelloListener.java
public interface HelloListener extends ParseTreeListener {
^
helloParser.java:12: error: class HelloParser is public, should be declared in a file named HelloParser.java
public class HelloParser extends Parser {
^
helloBaseListener.java:3: error: package org.antlr.v4.runtime does not exist
import org.antlr.v4.runtime.ParserRuleContext;
^
helloBaseListener.java:4: error: package org.antlr.v4.runtime.misc does not exist
import org.antlr.v4.runtime.misc.NotNull;
^
helloBaseListener.java:5: error: package org.antlr.v4.runtime.tree does not exist
import org.antlr.v4.runtime.tree.ErrorNode;
....
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…