Right click on your project –> Project Properties
Then in Sources
set Source/Binary Format
to JDK 7.
EDIT 1 :
There is a NetBeans issue:
Works fine in J2SE project, Web project specific problem.
The problem is that fork=”false” the JDK 7.0 params are passed to JDK 6.0
compiler. The executable requires fork=”true”.
On the line 293 of build-iml.xml the
<javac
debug="@{debug}"
deprecation="${javac.deprecation}" destdir="@{destdir}"
encoding="${source.encoding}"
excludes="@{excludes}"
executable="${platform.javac}"
fork="${javac.fork}"
includeantruntime="false"
includes="@{includes}"
source="${javac.source}"
srcdir="@{srcdir}"
target="${javac.target}"
tempdir="${java.io.tmpdir}">
should become:
<javac
debug="@{debug}"
deprecation="${javac.deprecation}"
destdir="@{destdir}"
encoding="${source.encoding}"
excludes="@{excludes}"
executable="${platform.javac}"
fork="yes" ;as opposed to ${javac.fork}
includeantruntime="false"
includes="@{includes}"
source="${javac.source}"
srcdir="@{srcdir}"
target="${javac.target}"
tempdir="${java.io.tmpdir}">
EDIT 2 (if first tips don’t work):
Try to run Netbeans IDE in JDK7.
Edit Netbeans conf file :
Linux
~/.netbeans/7.0/etc/app.conf
Mac Os X
/Applications/NetBeans/NetBeans\ 7.1.app/Contents/Resources/NetBeans/harness/etc/app.conf
Add the jdk7 path in the line jdkhome=
.
Or
Launch netbeans using :
netbeans –jdkhome /Java7/Home/dir