Why is java -version implemented in Java?
Alan Bateman
Alan.Bateman at oracle.com
Sat Nov 21 08:20:28 UTC 2020
On 20/11/2020 19:44, Thomas Stüfe wrote:
> :
>
> I know about the "release" file, but this does not seem like an
> obvious solution. I see this file mentioned as a way to quickly get
> the java release info, but it seems so strange and non-obvious. I feel
> bad that users have to even do that.
>
The release file was added (I think JDK 7) to allow humans and scripts
easily identify the run-time image. Running `java -version` is not an
option in many cases, esp. when there is a possibility that the image is
for a different platform or architecture. I remember there were issues
some scripts (and one IDE in particular) that was peeking into jvm.dll
to get vendor information. More recently, the release file was extended
via JEP 220 so that scripts could easily identify the modules used to
build that image. So I think it is very useful, even if it's not exactly
what you want here.
-Alan
More information about the jdk-dev
mailing list