Fwd: New feature in JDK 9 builds: javac -release $VERSION

Martijn Verburg martijnverburg at gmail.com
Mon Jul 13 08:47:11 UTC 2015

Hi all,

A new quick and useful feature for people to try!  This should eventually
eliminate one class of errors I always get with Maven and mutli JDK builds.


---------- Forwarded message ----------
From: joe darcy <joe.darcy at oracle.com>
Date: 13 July 2015 at 04:50
Subject: New feature in JDK 9 builds: javac -release $VERSION
To: "jdk9-dev at openjdk.java.net" <jdk9-dev at openjdk.java.net>


As of JDK 9 b72 [1], a feature recently pushed by Jan Lahoda is now
available: the javac -release command line option.

This feature was developed under JEP 247: Compile for Older Platform
Versions [2]. In brief, to use javac to cross-compile to an older release
of the platform it is not sufficient to just set the -source and -target
options to the older value; the bootclasspath must also be set to
correspond to the older release too. [3] Setting the bootclass was often
forgotten and acquiring the needed information could be inconvenient.

The -release flag in javac addresses both of these shortcomings. Now only a
single flag (-release) needs to be set to cross compile compared to three
flags (-source, -target, -bootclasspath) and the needed information is
included in the JDK. The set of release values follows the same "one plus
three back" policy now used for the -source and -target options. [4]
Therefore, in JDK 9, the accepted argument values for -release are 6, 7, 8,
and 9.

Feedback on the this feature can be sent to compiler-dev at openjdk.java.net.



[1] https://jdk9.java.net/download/

[2] http://openjdk.java.net/jeps/247

[3] "How to cross-compile for older platform versions,"

[4] JEP 182: Policy for Retiring javac -source and -target Options

More information about the adoption-discuss mailing list