> On Aug 8, 2016, at 8:51 AM, Paul Benedict <pbened...@apache.org> wrote: > > 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.
Have you considered checking the JAVA_VERSION property in $JAVA_HOME/release file? jlink creates the `release` file containing certain properties about the runtime image. Mandy