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:
- Click to “Download and Install” Java from java.com.
- After the completion of the installation process
- Click on the Start menu option
- Enter by typing the “Advanced system ”
- Click on the View advanced system settings, to open System Properties.
- Now, click on the Advanced option
- Then, click on the Environment Variables button
- Under System variable, click on the New button
- 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.
- Click on the OK button
- Now, from the Environment Variable window, you need to choose Path under System variable option
- Click on the Edit tab, to open the Edit environment variable window.
- Click on the New button and now type %JAVA_HOME%\bin in the given box
- 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
- Click to open Command prompt tab
- Now, click to type echo %JAVA_HOME%
- Now, click on the Enter tab
- Then, it should print the directory of the JDK that JAVA_HOME is pointing
- Alternatively, if any space appears on the screen, then it simply means that you have failed in setting up the environment variable
- 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.