How to verify java version and java installation

Once you have installed java in your system, the next step is to check whether it has been installed properly or not. This tutorial explains the steps to check java installation in your system. It covers both the cases, first if Path variable for java is not set and second if Path variable for java is set after installation.

1. If Path variable is not set, to check if java is installed properly or not, open a command terminal like CMD, Secure Shell Client etc. and change or move to the java installation directory upto bin folder, now execute the command java -version. It will display the installed java version and other relevant information about java. Java compiler version can also be checked by executing javac -version command.

check java version

The image above shows the steps for checking java installation in Windows operating system using CMD terminal. Similarly for linux based operating system, execute the same command in any linux based terminal to check java installation.

2. If Path is set, no need to move to java installation directory, just execute the command java -version in any directory. It will display the installed java version and other relevant information about java. For compiler version execute javac -version command.

java version

If any of the above methods returns the version correctly, which means java is installed properly. Now you can start your first program in java.

How do I know if Java is installed on Windows 10 ?

The steps are same irrespective of which version of windows you are using. Just follow above steps to check if java is installed on windows 10 or not.

If java is not installed, it will display an error message in Windows like "java is not recognized as internal or external command, operable program or batch file" after executing the command.

java not installed

What to do if I am getting error message like above "java is not recognized as .... " ?

There are two reasons of above error message, First java is not installed at all, you should install java and Second java is installed but Path variable is not set properly, you should set Path variable for java.

The following figure shows a typical structure of java installation directory in windows operating system. The installation directory could be different in different OS because it completely depends on OS and programmers selection as where to install java.

java installation directory

How to check where is java installed in windows/linux ?

In window, execute where java command in CMD to get the java installation directory. In linux, to get the java installation directory execute which java command in a terminal.

Does Windows 10 need Java ?

Yes if you want to develop/run java programs or application otherwise no.

Can I remove Java from my PC ?

Yes if it's no longer needed, you can uninstall java in same way as you uninstall any other software.

How do I know if I have Java JDK installed ?

Just execute java -version and javac -version command as given above inside a terminal to see if java jdk is installed or not. If these commands returns version of java and java compiler, it means java jdk is installed on your system.

★★★
  • You must be in bin directory of jdk to check java installation if Path variable is not set.
  • As a good practice you should always set your path variable first before you start writing programs in java.
  • You can execute java -help command on terminal to get different usage of java command.
  • Once you set the path of java, you need to restart the cmd(if already open) to get the correct result of java -version or javac -version command.