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 messages like:
warning: java/lang/Boolean.class(java/lang:Boolean.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
and
javac: invalid target release: 1.7
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/harness/suite.xml:184: The following error occurred while executing this line:
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/harness/common.xml:206: Compile failed; see the compiler error output for details.
So as far as I understand Netbeans is using javac 1.6. How can I change in to 1.7?
EDIT:
I'm writing a NetBeans Platform app and in main app Properties I've set: Java Platform = JDK 1.7. And in one of the module's Properties I've set Source level = 1.7.
EDIT2
- Mac OS 10.7.3
- NetBeans IDE 7.1 (Build 201112071828)
- openjdk version "1.7.0-internal"
- OpenJDK Runtime Environment (build 1.7.0-internal-uko_2012_02_15_11_51-b00)
- OpenJDK 64-Bit Server VM (build 23.0-b15, mixed mode)
suite.xml (184 is the second line here)
<target name="build" depends="-init,branding,release,-hide-excluded-modules" description="Build all modules in the suite.">
<subant target="netbeans" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false">
<property name="cluster.path.evaluated" value="${cluster.path.evaluated}"/> <!-- Just for speed of pre-7.0 projects -->
</subant>
</target>
common.xml (206 is the second line here)
<nb-javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
<classpath refid="cp"/>
<compilerarg line="${javac.compilerargs}"/>
<processorpath refid="processor.cp"/>
</nb-javac>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…