-version output differs from --version output

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Tue Jul 2 15:04:08 UTC 2019


Thanks, so this is deliberate.

Maybe this should be documented in the help message java -h
like "print product version _in a different format_ to output stream..."
... but maybe not.

Best regards,
  Goetz.

> -----Original Message-----
> From: jdk-dev <jdk-dev-bounces at openjdk.java.net> On Behalf Of Roger Riggs
> Sent: Dienstag, 2. Juli 2019 16:08
> To: jdk-dev at openjdk.java.net
> Subject: Re: -version output differs from --version output
> 
> Hi Goetz,
> 
> For decades, -version is printed to stderr and --version is printed to
> stdout.
> For compatibility reasons, -version has been kept particularly stable
> given the number of
> apps that parse the first line.
> 
> Roger
> 
> p.s. see libjli/java.c::parseArguments and
> java.lang.VersionProps.print/println().
> 
> 
> On 7/2/19 5:26 AM, Lindenmaier, Goetz wrote:
> > Hi,
> >
> > The two output differ in the string 'version' and quoting of the version:
> >
> > output-jdk/images/jdk/bin/java -version
> > openjdk version "14.0.0.1-internal" 2019-07-01
> > OpenJDK Runtime Environment (build 14.0.0.1-internal+0-adhoc.openjdk.jdk)
> > OpenJDK 64-Bit Server VM (build 14.0.0.1-internal+0-adhoc.openjdk.jdk,
> mixed mode, sharing)
> >
> > output-jdk/images/jdk/bin/java --version
> > openjdk 14.0.0.1-internal 2019-07-01
> > OpenJDK Runtime Environment (build 14.0.0.1-internal+0-adhoc.openjdk.jdk)
> > OpenJDK 64-Bit Server VM (build 14.0.0.1-internal+0-adhoc.openjdk.jdk,
> mixed mode, sharing)
> >
> > is this intended, or is this a bug?
> > It is actually coded like this in VersionProps.java.template print().
> >
> http://hg.openjdk.java.net/jdk/jdk/file/8a153a932d0f/src/java.base/share/cla
> sses/java/lang/VersionProps.java.template
> >
> > Best regards,
> >    Goetz.
> >
> >



More information about the jdk-dev mailing list