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

我在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

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...