This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203088

Summary: "javac: invalid target release: 1.7" when trying clean/build on Mac with JDK 7 Developer Preview
Product: javaee Reporter: host <host>
Component: Web ProjectAssignee: David Konecny <dkonecny>
Status: VERIFIED FIXED    
Severity: normal CC: molle, tzezula
Priority: P2    
Version: 7.1   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description host 2011-10-04 18:38:40 UTC
I am using the latest NB daily on Mac running on 1.6.0_26 and I have added the JDK 7 Developer Preview for Mac as a platform. In the properties of my Web app project I have set source/binary format to JDK 7. Now when I try to clean/compile this project, I get the following error:

javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options
/Users/holger/Development/ObTiMA/nbproject/build-impl.xml:580: The following error occurred while executing this line:
/Users/holger/Development/ObTiMA/nbproject/build-impl.xml:292: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)
Comment 1 host 2011-10-04 18:39:31 UTC
I forgot: I also set the platform of the project correctly to JDK 7.
Comment 2 Jan Lahoda 2011-10-06 16:12:33 UTC
Tomas, any idea what could be wrong? Thanks.
Comment 3 Tomas Zezula 2011-10-07 06:26:39 UTC
I will download the dev preview and try.
Comment 4 Tomas Zezula 2011-10-18 17:07:01 UTC
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}">
Comment 5 David Konecny 2011-10-19 07:58:00 UTC
Thanks for the solution Tomas.
webmain #a274f88d445d
Comment 6 Quality Engineering 2011-10-24 14:07:43 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a274f88d445d
User: David Konecny <dkonecny@netbeans.org>
Log: #203088 - "javac: invalid target release: 1.7" when trying clean/build on Mac with JDK 7 Developer Preview