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 250430 - NetBeans should properly support cross-compiling
Summary: NetBeans should properly support cross-compiling
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 8.0.2
Hardware: PC Other
: P3 normal (vote)
Assignee: Dusan Balek
Depends on:
Reported: 2015-02-15 08:37 UTC by terje7601
Modified: 2015-02-15 08:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description terje7601 2015-02-15 08:37:38 UTC
In the Project Properties:
under Sources you have "Source/Binary Format"
under Libraries you have "Java Platform"

In my case, there is only 1 Java Platform, JDK 1.8. Now suppose I set the "Source/Binary Format" to Java 7 (i.e. "JDK 7" (Ant) or "1.7" (Maven)). The problem now is that Java 8 language constructs (like lambda expressions) are marked as errors, but usage of Java 8 APIs isn't. In my opinion, if one sets the "Source/Binary Format" to Java 7, it means they intend to run the program on JRE 7. So usage of Java 8 APIs should be marked as errors as well (and such classes should be excluded from auto-completion etc.).

NetBeans ought to give a warning and tell the user to add a "JDK 1.7" Java Platform. For Java 7, NetBeans could just provide a link to the "Server JRE" downloads (since it's a simple zip, I personally prefer this over a JDK installation).

The real problem here, is that NetBeans should cross-compile by using the javac "bootclasspath" and "extdirs" options. These options should point to a JDK installation that matches the "target" option. From : "It is important to use the -bootclasspath and -extdirs options when cross-compiling."