Sometimes it is required to check the current version of Java installed.
By Java version i mean the version of Java Development Kit (JDK) or the version of Java Runtime Environment (JRE).
As JDK and JRE are different components of Java (JDK is used to compile Java programs while JRE is used to run them), there are different commands to check their versions.
This short note explains how to find out the current version of Java (JDK/JRE) from the command line.
Cool Tip: How to install Maven in Windows! Read more →
Get Current Java Version
Get the current Java Runtime Environment (JRE) version:
$ java -version
Get the current Java Development Kit (JDK) version:
$ javac -version