intellij idea - 错误:java:无效的源代码版本1.9
2022-08-31 06:45:46
我正在尝试运行我的JSQL解析器类,但我得到了.Error: java: invalid source release 1.9
我试图遵循这个答案。我更改了File> Build,Execution,Deployment>Java Compiler> Project字节码版本:1.8。但是,我无法将模块语言级别和项目语言级别更改为 1.8,因为没有相应的选项。我仍然在下面得到同样的错误。
法典
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();
}
}
}