Error:java: error: invalid source release: 13 using JDK12 with IntelliJ

后端 未结 3 2037
既然无缘
既然无缘 2021-01-02 08:09

I am trying to build a project with JDK-12 ea. While trying to execute a sample class:

public static void main(String[] args) {
    Scanner scanner = new Sc         


        
3条回答
  •  走了就别回头了
    2021-01-02 08:27

    Just for the record. I was having similar error but with Java 14:

    Error:java: error: invalid source release: 14
    

    What solved the problem for me was to hunt down on every single place of the IDE where there was another Java version being mentioned that wasn't the 14th one.

    The places that I had to change were:

    File -> Project Structure -> Project Settings

    File -> Project Structure -> Module Settings -> Tab: Sources: Language Level.

    File -> Project Structure -> Module Settings -> Tab: Dependencies: Module SDK.

    File -> Settings -> Compiler -> Java Compiler -> Target bytecode version.

提交回复
热议问题