How To Set Java_Home Environment Variable?

According to the UNIX term, an environment variable is a string which always holds the information such as drive name, pathname, filename, etc. JAVA_HOME is an environment variable which directly addresses towards the directory where the Java Development Kit or Java Runtime Environment is already installed in the system.

However, to be specific utter, if you have already installed Java in the path C:\ Program Files\Java\jdk1.8.0_121 on your computer then your Java_Home is now C:\Program Files\Java\jdk1.8.0_121. Mainly, the JAVA_Home is merely excellent which is used by Java-based programs like Apache Tomcat and some other app server tools to easily find where the Java is actually placed in the system.

Moreover, these third-party programs are always making use of the environment variables which point to the directory of JRE or JDK. In simple terms, it will always make easy for the programs to easily locate the directory executable like javac in the computer system. Sometimes when you are not using these third party programs, then it might not even be mandatory for the users to set up the JAVA_Home in your system.

In this article, we try to provide you the best and detailed information about how to set JAVA_HOME as the environment variable in the Windows 10.

Steps to Setting JAVA_HOME in Windows 10

Set the JAVA_HOME environment variable & update the system path by following a few simple steps. The steps are discussed below:

  1. Click to “Download and Install” Java from java.com.
  2. After the completion of the installation process
  3. Click on the Start menu option
  4. Enter by typing the “Advanced system ”
  5. Click on the View advanced system settings, to open System Properties.
  6. Now, click on the Advanced option
  7. Then, click on the Environment Variables button
  8. Under System variable, click on the New button
  9. Now, in the Edit System Variable, Provide the name of the Variable as JAVA_HOME and also Variable value as the path to your JDK directory.
  10. Click on the OK button
  11. Now, from the Environment Variable window, you need to choose Path under System variable option
  12. Click on the Edit tab, to open the Edit environment variable window.
  13. Click on the New button and now type %JAVA_HOME%\bin in the given box
  14. Click on the OK tab, to apply changes.

Check JAVA_HOME Configuration Setup by Using CMD

For testing your configuration, you need to follow the given process

  1. Click to open Command prompt tab
  2. Now, click to type echo %JAVA_HOME%
  3. Now, click on the Enter tab
  4. Then, it should print the directory of the JDK that JAVA_HOME is pointing
  5. Alternatively, if any space appears on the screen, then it simply means that you have failed in setting up the environment variable
  6. Finally, click to type javac – a versionwhich should easily print the version of Java compiler

If no any space appears on the screen than it will print a message that javac is not identified an internal or external command. It means that the path variable is still not set correctly or properly.

Hopefully,  the process mentioned above will help you in solving your errors easily.