Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
12.5
-
None
-
None
Description
JEP 247 enhances javac so that it can compile Java programs to run on selected older versions of the platform.
If for instance javac from JDK 17 should compile a program for Java 8 compatibility, then the following command line is suitable:
javac --release 8 Main.java
The --release option can be specified in Netbeans projects here: Build -> Compiling -> Additional Compiler Options.
Unfortunately the --release option results in build errors, at least with Netbeans ANT projects:
error: option -source cannot be used together with --release
The full build log:
ant -f /tmp/NetBeansProjects/JavaApplication9 -Dnb.internal.action.name=rebuild clean jar
init:
deps-clean:
Updating property file: /tmp/NetBeansProjects/JavaApplication9/build/built-clean.properties
Deleting directory /tmp/NetBeansProjects/JavaApplication9/build
clean:
init:
deps-jar:
Created dir: /tmp/NetBeansProjects/JavaApplication9/build
Updating property file: /tmp/NetBeansProjects/JavaApplication9/build/built-jar.properties
Created dir: /tmp/NetBeansProjects/JavaApplication9/build/classes
Created dir: /tmp/NetBeansProjects/JavaApplication9/build/empty
Created dir: /tmp/NetBeansProjects/JavaApplication9/build/generated-sources/ap-source-output
Compiling 2 source files to /tmp/NetBeansProjects/JavaApplication9/build/classes
error: option -source cannot be used together with --release
error: option -target cannot be used together with --release
Usage: javac <options> <source files>
use --help for a list of possible options
BUILD FAILED (total time: 0 seconds)