Why is java -version implemented in Java?

Jonathan Dowland jdowland at redhat.com
Tue Dec 1 09:55:09 UTC 2020


On Fri, Nov 20, 2020 at 05:22:15PM +0100, Thomas Stüfe wrote:
> Or is using 'java -version' as a simple VM test just too convenient?

I've used it as a quick way to get a valid java invocation in order to
test other parameters (e.g. -XX:+UnlockDiagnosticVMOptions
-XX:+PrintContainerInfo) without having to have a valid Java program
(Jar, class, source file, etc.) around. I could use --dry-run, but I'd
either need to keep HelloWorld.class to hand or tolerate the invocation
error. On the other hand I can see the appeal of making bare "java
-version" operate more quickly.

-- 
���� Jonathan Dowland <jdowland at redhat.com>
Senior Software Engineer, OpenJDK, Red Hat



More information about the jdk-dev mailing list