The java command returns the version when calling it with the -version parameter
java -version
The output of the java version command will be the following on windows:
C:\Users\Olivier>java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
The output of the java version command will be the following on linux:
$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
how to check java version in cmd