How to set JAVA_HOME in Windows 10

In Unix terminology, an Environment variable is a string that holds information such as drive name, pathname, filename, etc. JAVA_HOME is an environment variable which addresses to the directory where Java Runtime Environment or Java Development Kit is installed in the system. To be precise say if you have installed Java in the path C:\Program Files\Java\jdk1.8.0_121 on your computer then your Java_Home is C:\Program Files\Java\jdk1.8.0_121. Basically, JAVA_Home is simply an exemplary used by Java-based programs like Apache Tomcat and other app server tools to find where Java is placed in the system.

These third-party programs make use of the environment variables that point to the directory of JDK or JRE. In simple words, it makes easy for the programs to locate the directory executable like javac in the computer. If you are not using these third party programs, then it may not be mandatory for users to set up JAVA_Home in your system. In this article, we will explain in detail how to set JAVA_HOME as the environment variable in Windows 10.

Setting JAVA_HOME in Windows 10

Set JAVA_HOME environment variable & update the system path

Download and install Java from the official site –

After installation, Go to Start menu and type Advanced system settings.

Click on View advanced system settings from the list to open System Properties.

Go to Advanced tab and click on Environment Variables button.

In the Environment Variable window, click on New button under the System variable.

In the Edit System Variable, give the Variable name as JAVA_HOME and Variable value as the path to your JDK directory.

Click on OK.

Now go back to the Environment Variable window and select Path under the System variable.

How to set JAVA_HOME in Windows 10

Click on Edit button to open Edit environment variable window.

Click on New button and type  %JAVA_HOME%\bin.

Click OK to apply the changes.

Check JAVA_HOME configuration setup using CMD

To test your configuration, open Command prompt.

Type echo %JAVA_HOME% and hit Enter. This should print the directory of the JDK which the JAVA_HOME is pointing. Instead, if you see a space, it means you have failed in setting up environment variable.

Next Type javac -version which should print the version of Java compiler.

If not it will print a message that the javac is not recognized as an internal or external command. This means the path variable is not set correctly.

Hope this helps!

Posted by on , in Category General with Tags
Pavithra is a Windows enthusiast, who loves keeping abreast with the latest in the world of technology.


  1. Krishan Gurusinghe

    Thank you. This was very helpful.

  2. Abhishek Kumar Gupta

    Thanks . This was very helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 9 =