Why is java -version implemented in Java?

Mario Torre neugens at redhat.com
Mon Nov 23 13:26:18 UTC 2020

 Mon, Nov 23, 2020 at 2:02 PM Thomas Stüfe <thomas.stuefe at gmail.com> wrote:
> >
> >
> >
> > One thought I have, and I don't know if that is good or bad, is that the
> > new, GNU-style long-option java --version that was introduced not too
> > long ago is not as likely to have this legacy of expecting VM startup.
> > It might be possible to redefine it to just print the version to stdout
> > and just exit. But that also means that java -version and java --version
> > behaves differently, and I don't know if that really is a good idea.
> >
> >
> I like the idea of repurposing --version. It could be short-wired to
> -Xinternalversion. "--version" certainly is snappier and easier to remember
> :)

I think think it's a good idea to have --version and -version behave
differently, it would be too easy to make a typo.


Mario Torre
Associate Manager, Software Engineering
Red Hat GmbH <https://www.redhat.com>
9704 A60C B4BE A8B8 0F30  9205 5D7E 4952 3F65 7898

More information about the jdk-dev mailing list