加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 在Netbeans中使用try-with-resources

发布时间:2020-12-14 19:18:30 所属栏目:Java 来源:网络整理
导读:我在Java servlet类中有一个try-catch语句. Netbeans显示错误: try-with-resources is not supported in -source 1.6 (use -source 7 or higher to enable try-with-resources) 我怎样才能摆脱这个错误? 最佳答案 看起来您从NetBeans论坛找到了我的帖子,我

我在Java servlet类中有一个try-catch语句. Netbeans显示错误:

try-with-resources is not supported in -source 1.6
(use -source 7 or higher to enable try-with-resources)

我怎样才能摆脱这个错误?

最佳答案
看起来您从NetBeans论坛找到了我的帖子,我在其中发布了解决方案:

I got the error to go away.

Right click on project > Properties > Sources > Source/Binary Format:
JDK 7 > OK.

资源:

>错误:在-source 6中不支持try-with-resources(使用-source 7或更高版本来启用try-with-resources)“:

http://forums.netbeans.org/ntopic42154.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读