Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to interpret this output from `java -version`?

Running java -version gives us the following output, but it’s unclear what version it’s running. The first line seems to be v11, but the second line appears to indicate that it’s running v18. What’s going on here?

java version "11.0.11" 2021-04-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This java -version command was executed by Java 11 (not 18).

Documentation for the -version flag suggests that the complete reference for java -version‘s output lives in Appendix A of the JSR-56 specification (PDF).

For your output above:

// Java major version 11, minor version 0, patch version 11, release date 20th Apr 2021, Long-Term-Support (LTS) version
java version "11.0.11" 2021-04-20 LTS

// JRE major version 18, minor version 9, exact build number
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)

// JVM major version 18, minor version 9, exact build number
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)

Making some edits to the text in the flag documentation, your exact build numbers on lines 2 and 3 of your original output mean:

the class or JAR file requires a version that is not less than 11.0.11

As per JDK-8216383, it seems line 2 of your original output ("vendor version") serves no purpose any more (thanks @Michael!).

For a definition of "mixed mode", see Why does Java , running in -server mode, say that the version is "mixed-mode"?

For more on the version discrepancy you’re observing, see: Why is java -version returning a different version to the one defined in JAVA_HOME?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading