Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 208464 - "javac: invalid target release: 1.7" when building a java 7 source on Mac
"javac: invalid target release: 1.7" when building a java 7 source on Mac
Status: RESOLVED FIXED
Product: apisupport
Classification: Unclassified
Component: Harness
7.1
All All
: P3 (vote)
: 7.2
Assigned To: Jesse Glick
issues@apisupport
:
Depends on: 209239
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-15 15:32 UTC by Uko
Modified: 2012-03-06 15:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uko 2012-02-15 15:32:38 UTC
I've added JDK7 into Java Platforms and have selected it in the project properties.

But when I'm building a progect, I get messages:

javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options
/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.
Comment 1 Uko 2012-02-15 15:48:46 UTC
Also I get warnings 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.

so it looks like a java 6 compiler is trying to compile 1.7 source
Comment 2 Tomas Zezula 2012-02-16 09:38:28 UTC
Api support specific.
Comment 3 Jesse Glick 2012-02-16 23:00:59 UTC
The NBM Ant harness uses the toolset from the IDE's JDK, so if you want to use a newer language version you need to run the IDE on that JDK. Not sure if it is possible to use a forked javac using the current harness; org.netbeans.nbbuild.CustomJavac is used to handle annotations.
Comment 4 Uko 2012-02-17 06:05:09 UTC
(In reply to comment #3)
> The NBM Ant harness uses the toolset from the IDE's JDK, so if you want to use
> a newer language version you need to run the IDE on that JDK. Not sure if it is
> possible to use a forked javac using the current harness;
> org.netbeans.nbbuild.CustomJavac is used to handle annotations.

My team mate on linux can successfully compile java 1.7 running NetBeans IDE on JDK6.

But if there is no other way, how should I run Netbeans on JDK7 on Mac?
Comment 5 Uko 2012-02-17 10:10:40 UTC
Ok, I've successfully started NetBeans as:
netbeans --jdkhome /path/to/jdk7

and it works. But
1) I guess NetBeans should be able to compile java7 running under JDK6.
2) Why I Netbeans running under JDK6 when i put
jdkhome="/path/to/jdk7"
in
/Applications/NetBeans/NetBeans\ 7.1.app/Contents/Resources/NetBeans/harness/etc/app.conf
?
Comment 6 Jesse Glick 2012-02-20 18:46:01 UTC
(In reply to comment #5)
> I guess NetBeans should be able to compile java7 running under JDK6.

For other project types it can; there are some technical difficulties in the case of Ant-based NB module projects which I am looking into.

> ...NetBeans/harness/etc/app.conf

I guess you meant to use ...NetBeans/etc/netbeans.conf, the IDE's own configuration. harness/etc/app.conf is a template to be copied into a NB-Platform-based application.
Comment 7 Jesse Glick 2012-02-20 18:57:39 UTC
core-main #630c26d3ebdb
Comment 8 Quality Engineering 2012-02-22 11:00:07 UTC
Integrated into 'main-golden', will be available in build *201202220400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/630c26d3ebdb
User: Jesse Glick <jglick@netbeans.org>
Log: #208464: use javac from selected platform.
Actually annoying when running IDE on JDK 7 and compiling with -source 6, since the JDK 7 compiler is better;
but necessary when running the IDE on JDK 6 and compiling with -source 7.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo