Why is java -version implemented in Java?

Thomas Stüfe thomas.stuefe at gmail.com
Sun Nov 22 06:33:06 UTC 2020

That exists already, as mentioned by David in this Thread:


I am not sure atm if this is supported by all JDKs but at least the
Oracle-provided OpenJDK and our SapMachine support that. But it is listed
under the "-X" options:

java -X
                     displays more detailed JVM version information than
                     -version option

so any downstream vendor who does not modify arguments.cpp should have it.

(Whether the text "more detailed JVM information" is fully accurate I am
not sure since we miss the information a JVM initialization would give us)

This does not need any JVM initialization. It is printed right at argument
parsing and then the VM stops.

The problem with option is that this seems to be as equally unknown as the
release file.

Cheers, Thomas

On Sun, Nov 22, 2020 at 7:08 AM Christian Stein <sormuras at gmail.com> wrote:

> On Sun, Nov 22, 2020 at 6:59 AM Thomas Stüfe <thomas.stuefe at gmail.com>
> wrote:
> > [...]
> > Pity. I guess we could run JVM initialization and still cut out the
> actual
> > invocation of VersionProps.java and just print all those infos from
> native
> > code within the hotspot. But I'm not sure how much this would actually
> > save.
> >
> What about introducing new java launcher options (named "--version-short",
> "--version-long", ..., "--print-version-in-jep223-[short|long]-format")
> that don't need an initialized VM?

More information about the jdk-dev mailing list