I\'m getting into Java7 development and I\'ve added JDK7 into Java Platforms and have selected it in the project properties.
But when I\'m compiling, I get
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" 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
This worked for me You can try this.
I was using Netbeans 8.2 and the jdk it was using was 1.8 and i wanted to compile the project in lower java version of 1.7. Right click on your project and go to the properties tab [properties tab options][1]
click on libararies.
Then click on manage libraries. [Manage libraries][2]
after that Add platform and add ur javapath and close [Adding java platform ][3]
Then you can build your project.
Update for NetBeans 8
:
The file to edit is
/Applications/NetBeans/NetBeans\ 8.0.app/Contents/Resources/NetBeans/harness/etc/app.conf
I added the line
jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk"
and restarted NetBeans, it accepted JDK 1.7 U67 as its compilation platform.