So I used JFlex to generate a file called Yylex.java without any problems. When I try to compile it with the command javac Yylex.java
, I get 30 errors, originating with this one:
Yylex.java:13: error: package java_cup.runtime does not exist
import java_cup.runtime.Symbol;
This is obviously caused by the first import in my JFlex file. Since I'm trying to use this with CUP, I read that I need to have the java-cup-11a.jar file and the java-cup-11a-runtime.jar in the same folder as Yylex.java, which I do. Anyone know what's wrong?
Simply putting the jars in the dir is not enough, you have to add them to the classpath using the -cp
command line option, so e.g.
javac -cp ava-cup-11a-runtime.jar Yylex.java