I'm trying to run my JSQL parser class, but I'm getting Error: java: invalid source release 1.9
.
I tried to following this answer. I changed File> Build,Execution,Deployment> Java Compiler> Project bytecode version: 1.8. However, I can't change the Module language level and Project language level to 1.8 because there's not option for that. I still get the same error below.
Error
Code
package cs4321.project2;
import java.io.FileReader;
import net.sf.jsqlparser.parser.CCJSqlParser;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.select.Select;
public class Parser {
private static final String queriesFile = "resources/input/queries.sql";
public static void main(String[] args) {
try {
CCJSqlParser parser = new CCJSqlParser(new FileReader(queriesFile));
Statement statement;
while ((statement = parser.Statement()) != null) {
System.out.println("Read statement: " + statement);
Select select = (Select) statement;
System.out.println("Select body is " + select.getSelectBody());
}
} catch (Exception e) {
System.err.println("Exception occurred during parsing");
e.printStackTrace();
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…