RFE to re-purpose option --version:<version>

Claes Redestad claes.redestad at oracle.com
Tue Aug 9 14:32:15 UTC 2016


1. --version:9 is ambiguous, maybe --require-version=9 would be better...
2. ... but it still doesn't seem worth the hours of testing, maintenance 
and subsequent bug-fixing for this niche use case
3. ... and even if it did get in there'd be a very long time until all 
versions of java installed will have the flag, limiting the usefulness 
for years to come, forcing scripts to workaround using, say, java 
-fullversion anyhow



On 2016-08-09 16:13, Paul Benedict wrote:
> Kumar, thank you for that information. I find that useful too. Now with
> regard to this email's proposal, are there any further opinions? If this
> has merit, I would appreciate if someone could create a ticket for
> consideration?
> Cheers,
> Paul
> On Mon, Aug 8, 2016 at 4:20 PM, Kumar Srinivasan <
> kumar.x.srinivasan at oracle.com> wrote:
>> Hello Paul,
>> There is a light weight method to get the version from the launcher,
>> "-fullversion" noting that, this does not invoke the VM, and obtains
>> the version string set at build time in the launcher itself.
>> However you would have to exec java twice, once to get the version,
>> another to invoke it.
>> Thanks
>> Kumar
>> Dear Committers,
>>> In Java 9, the --version:<version> has been deprecated. The error message
>>> returned to me is:
>>> Error: Specifying an alternate JDK/JRE version is no longer supported.
>>>     The use of the flag '-version:' is no longer valid.
>>>     Please download and execute the appropriate version.
>>> Unrecognized option: -version:9
>>> I am happy with that. This is not a complain on removing that "alternate"
>>> feature.
>>> However, I would like to propose bringing back the option with a different
>>> purpose. I would like to use --version:<version> as a validation check. I
>>> want Java to execute ONLY if the version specified matches the actual
>>> platform version. This would be a wonderful help to scripts that require a
>>> particular version of the Java platform, and should fail if the
>>> environment
>>> has been accidentally setup with the wrong Java platform version.
>>> Examples:
>>> java --version:9
>>> java --version:9.1
>>> AFAICT, the only way to do this now is to execute Java twice. Once to pipe
>>> --version to some find/grep command and check return code, and then
>>> execute
>>> java again if the check pass. Loading the runtime twice is not optimal,
>>> wouldn't you agree? Yet if you agree to this proposal, it would be a big
>>> win for script writers, I believe.
>>> Opinions please. Thank you.
>>> Cheers,
>>> Paul

More information about the core-libs-dev mailing list