How to set JAVA_HOME on Windows [ 2024]
How to set JAVA_HOME on Windows
This page will teach us how to set the JAVA_HOME environment variable on the Windows operating system. The JAVA_HOME environment variable is used in many scripts that support Java, servers, and other applications.
We can perform this setup during the Java installation process.
Java JDK Download
Identify JDK directory
Identify the JDK directory path on your computer to set it as the Java home environment variable. If your computer has multiple JDK installations, it’s recommended that you choose the latest version as the Java home.
Control Panel
Launch Control Panel >> System and Security>> System.
Click on Advanced System Settings >> Environment Variables.
Set JAVA_HOME
Click on the New Environment variable and set the JAVA_HOME variable.
Click on the OK button to save the variable. Close the control panel.
Verify
Open the command prompt and type the following command to verify the variable.
/> echo %JAVA_HOME%
The command should display the JDK directory path to the console.
Video Tutorial
Importance
Setting this variable is important for the smooth running of Java-dependent applications. Application scripts refer to this variable and build the paths to access the Java tools.
For example, starting the Tomcat Server failed because the JAVA_HOME environment variable was not set.
Java Tutorials
Java Tutorial on this website: