How to Know Version of Java?

Open a terminal or command prompt

Type `java -version`

Press Enter

Check the version shown in the output

To check the compiler version, type `javac -version`

Press Enter

Check the version shown in the output

On Windows, you can also open Command Prompt and run `where java`

On macOS or Linux, you can also run `which java`

If multiple Java versions are installed, check the active one with `echo $JAVA_HOME` on macOS or Linux

On Windows, check the `JAVA_HOME` environment variable in System Properties

Suggested for You

Trending Today