How to run JFlex and JavaCUP
if you are here, so you have a problem somehow related to Compiler and specifically to JFlex and JavaCUP. First I suggest you read completely, to install according your operating system.
link #1 [Linux installation (Bash shell)]
link #2 [Linux installation]
link #3 [Windows installation]
link #1 [Linux installation (Bash shell)]
link #2 [Linux installation]
link #3 [Windows installation]
If you have still any problem, like “Could not find or load main class”, before continuing make completely sure about “System Variables” and “CLASSPATH” and do as link #1 or #2 or #3. For a complete explanation about causes, read this link.
I assume that you did exactly as it is explained in link #3, and you can compile everything with no error, but the command “java Main inputfile.txt” is not working. It is mostly because Java can`t load the classes from “import java_cup.runtime.*;”, so “Main.class” is not known for Java (right now). All you need to do:
۱- move all the files [Main.java, parser.cup, scanner.jflex] to the root folder of “JavaCUP” and paste them there.
۲- compile everything again and run “java Main inputfile.txt”.
۲- compile everything again and run “java Main inputfile.txt”.
Note #1: JavaCUP needs the file “CUP$parser$actions.class” after compiling the parser, so never delete that.
Note #2: For a new project you just need to do as above, so move the previous files to a folder and create the new files.
Note #3: If you recompiled, Jflex may keep a copy of the previous file. Note that if there is/are (an) error(s) in new change(s), jflex may not compile the new changes and still calculate based on the previous file.
Note #2: For a new project you just need to do as above, so move the previous files to a folder and create the new files.
Note #3: If you recompiled, Jflex may keep a copy of the previous file. Note that if there is/are (an) error(s) in new change(s), jflex may not compile the new changes and still calculate based on the previous file.
0
0