...
You must set your JAVA_HOME
environment variable to point to the directory where the Java Development Kit (JDK) is installed on the computer. Typically, the JDK is installed in a directory under C:/Program Files/Java
, such as C:/Program Files/Java/jdk1.67.0_2780
. If you have multiple versions installed, choose the latest one, which you can find by sorting by date.
...
- Right-click the My Computer icon on the desktop and click Properties.
- In the System Properties window, click the Advanced tab, and then click Environment Variables.
- Click New under System variables (for all users) or under User variables (just for the user who is currently logged in).
- Enter the following information:
- In the Variable name field, enter:
JAVA_HOME
- In the Variable value field, enter the installation path of the Java Development Kit, such as:
c:/Program Files/Java
jdk1.67.0_2780
- In the Variable name field, enter:
The JAVA_HOME
variable is now set and will apply to any subsequent command prompt windows you open. If you have existing command prompt windows running, you must close and reopen them for the JAVA_HOME
variable to take effect, or manually set the JAVA_HOME
variable in those command prompt windows as described in the next section. To verify that the JAVA_HOME
variable is set correctly, open a command window (from the Start menu, click Run, and then type CMD
and click Enter) and execute the following command:
...
In the command prompt window, enter the following command where
<JDK_INSTALLATION_PATH>
is the JDK installation directory and press Enter.set JAVA_HOME=<JDK_INSTALLATION_PATH>
For example:
set JAVA_HOME=c:/Program Files/java/jdk1.67.0_2780
The
JAVA_HOME
variable is now set for the current CMD session only.- To verify that the
JAVA_HOME
variable is set correctly, execute the following command:set JAVA_HOME
- The system returns the JDK installation path.
...