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 208464 - "javac: invalid target release: 1.7" when building a java 7 source on Mac
Summary: "javac: invalid target release: 1.7" when building a java 7 source on Mac
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Harness (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 209239
Blocks:
  Show dependency tree
 
Reported: 2012-02-15 15:32 UTC by Uko
Modified: 2012-03-06 15:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


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.