Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using try-with-resources in Netbeans

I have a try-catch statement in a Java servlet class. Netbeans shows an error on this:

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

How can I get rid of this error?

like image 776
CheeHow Avatar asked Oct 08 '22 11:10

CheeHow


1 Answers

It looks like you found my thread from the NetBeans forums, in which I posted the solution:

I got the error to go away.

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

Source:

  • Error: "try-with-resources is not supported in -source 6 (use -source 7 or higher to enable try-with-resources)":

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

like image 104
XP1 Avatar answered Oct 12 '22 12:10

XP1