美文网首页
java: -source 1.5 中不支持 try-with-

java: -source 1.5 中不支持 try-with-

作者: letsgetdrunk | 来源:发表于2019-03-21 11:41 被阅读0次

报错:

Error:(19, 13) java: -source 1.5 中不支持 try-with-resources
  (请使用 -source 7 或更高版本以启用 try-with-resources)

在网上查阅解决方法

  1. File - Project Structure -Project - Language Level 更改为8
    无法解决。
  2. pom.xml 添加dependency
    无法解决。
  <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
  </properties>
  1. File - Project Structure -Modules- Language Level 更改为8
    解决。

相关文章

网友评论

      本文标题:java: -source 1.5 中不支持 try-with-

      本文链接:https://www.haomeiwen.com/subject/rdkqvqtx.html