java --version
Java –version
// If you have the Java Runtime Environment (JRE) version installed, run this command on your terminal(Command Prompt - for windows):
java -version
// If you have the Java Compiler version installed, run this command [still on your terminal(Command Prompt - for windows)]:
javac -version
System.getProperty("java.version")