I am trying to run ANTLR v4 with Java. I am trying to run the below file, Hello.java:
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.ParseTree;
public class Hello {
public static void main(String[] args) throws Exception {
System.out.println("Testing");
}
}
with the following script test.sh:
#!/bin/sh
ANTLR_LIB="antlr-4.9.2-complete.jar"
# Making an empty out directory
touch out
rm -r out
mkdir out
# Generating code
java -jar ${ANTLR_LIB} -no-listener -visitor Expr.g4 -o out/
# Adding in our own code
cp *.java out/
# Compiling everything together
javac -classpath ".;[MY FILE PATH]\antlr-4.9.2-complete.jar" -cp .:out:${ANTLR_LIB} out/Hello.java
# Showing the parse tree
# java -cp .:out:${ANTLR_LIB} org.antlr.v4.gui.TestRig Expr prog -gui $1
# Run the calculator
# java -classpath .:out/:${ANTLR_LIB} Calc $1
I have set my CLASSPATH to include antlr-4.9.2-complete.jar, but when I try to run the script, I run into this error:
I am unsure how to resolve this error.