In Unix terminology, an environment variable is a string containing information such as drive name, path, filename, etc. JAVA_HOME is an environment variable that points to the directory where Java Runtime Environment or Java Development Kit is installed in the system. To be specific, say if you have Java installed 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 just an example used by Java-based programs like Apache Tomcat and other application server tools to find where Java is placed in the system.
These third-party programs use environment variables that point to the JDK or JRE directory. In simple words, it is easy for the programs to locate the executable directory like javac in the computer. If you are not using these third-party programs, it may not be mandatory for users to configure JAVA_Home in your system. In this article, we will explain in detail how to set JAVA_HOME as an environment variable in Windows 10.
Configuring JAVA_HOME in Windows 11/10
Set the JAVA_HOME environment variable and update the system path
Download and install Java from official website – java.com.
After installation, go to To start up menu and tap Advanced System Settings.
Click on View advanced system settings in the list to open system properties.
Go to Advanced tab and click Environment variablebutton s.
In the Environment Variable window, click New under the system variable.
In the Edit System variable, provide variable name as JAVA_HOME and variable value as path to your JDK directory.
Click on OKAY.
Now go back to the Environment Variable window and select Path under the system variable.
Click on Edit button to open the Edit Environment Variable window.
Click the New button and type %JAVA_HOME%\bin.
Click on OKAY to apply the changes.
Check configuration of JAVA_HOME configuration using CMD
To test your configuration, open command prompt.
Type echo %JAVA_HOME% and press Enter. This should print the JDK directory that JAVA_HOME points to. Instead, if you see a space, it means you failed to set up the environment variable.
Next type javac-version which should print the Java compiler version.
Related : How to Fix Most iPhone Problems Quickly and Easily
Otherwise it will display a message that the javac is not recognized as an internal or external command. This means that the path variable is not set correctly.
I hope this helps you!