Try With Resources Not Supported at This Language Level

前端 未结 3 2289
再見小時候
再見小時候 2021-02-20 11:28

I\'m using IntelliJ IDEA Ultimate 2016.2.1, have set Project SDK to my 1.8 version, Project Language Level to 8, Module SDK to my 1.8 version, and JDK home path to /Library/Java

相关标签:
3条回答
  • 2021-02-20 12:06

    Hey @Calicoder just try to make change your Java compiler version into 1.7 or 1.8 as mentioned below

    Thanks hope this will help.

    0 讨论(0)
  • 2021-02-20 12:09

    I have found that IntelliJ sometimes defaults modules to language levels that don't match the set project SDK. Try right clicking on the module in the project explorer and select module settings and then the language level tab. If that is set to Java 5 then update it to Java 8.

    0 讨论(0)
  • 2021-02-20 12:15

    Make sure your try-with-resources is using the correct semantics. For instance, this:

    try (new BufferedReader(request.getReader())) {
    
    }
    

    will produce that same error message.

    0 讨论(0)
提交回复
热议问题