Set JAVA_HOME environment variable on Windows 10

  • vnull
  • Pub Jan 13, 2023
  • Edited Jan 14, 2023
  • 2 minutes read

Java Setup

Install JDK and set JAVA_HOME

Download the Java Development Kit (JDK)

Then double click the JDK and follow all the installation steps.

To set JAVA_HOME on a Windows 10:

Tested with:

  1. Windows 10
  2. JDK 1.9

JAVA_HOME is the name of an environment variable on the operating system that points to the installation directory of JDK (Java Development Kit) or JRE (Java Runtime Environment).


JAVA_HOME = C:\Program Files\Java\jdk-19
  1. Identify the Java home directory, which is generally under C:\Program Files\Java directory.

  1. Advanced System Settings

Open the System Environment Variables dialog by typing environment in the search area on Start menu

Click the button Environment Variables

Create the JAVA_HOME environment variable by clicking the New button at the bottom.

In the New System Variable form, enter the name and value as follows:

C:\Program Files\Java\jdk-19

Click OK, and you will see the JAVA_HOME variable is added to the list.

Update the PATH system variable. In the Environment Variables dialog, select the Path variable and click Edit:

Then in the Edit environment variable dialog, double click on the empty row just below the last text line, and enter %JAVA_HOME%\bin as follows:

The percent signs tell Windows that it refers to a variable JAVA_HOME, and the \bin specifies the location of java.exe and javac.exe programs which are used to run and compile Java programs, as well as other tools in the JDK. Click OK button to close all the dialogs. Now open application to verify. Or open a command prompt and type the following:

java -version
java version "19.0.1" 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)

javac -version
javac 19.0.1


You can add the path to the bin directory of Java home directly into the PATH variable, but it is recommend to follow the above steps to setup a JAVA_HOME variable because many Java programs depend on it. When you installed a JDK, this might not need to update the system variable because the installer already did it.

Next in the Series:

Do you have an idea or suggestion for a blog post? Submit it here!

Related Posts

2023 Phoenix VMUG UserCon

  • vnull
  • Sep 8, 2023
  • 4 minutes read

Introduction: The recent 2023 Phoenix VMUG UserCon brought together some like-minded people in the field, with discussions ranging from VMware technologies to best practices for optimizing existing systems.

Read more

Red Hat User Group Insights, Ansible Automation Platform, and ITSM Integration

  • vnull
  • Jun 1, 2023
  • 3 minutes read

Introduction: This blog post aims to summarize the key takeaways from this informative workshop. At the recent Red Hat User Group workshop on Red Hat Insights, Red Hat Ansible Automation Platform, and their integration with management (ITSM) systems, such as ServiceNow, provided valuable insights into how these technologies work together.

Read more

Robocopy Examples

  • vnull
  • Feb 10, 2023
  • 5 minutes read

Robocopy Examples Robocopy has many command line options and it can be overwhelming to know which commands to use. In this post, we will take a look at how to ues robocopy to copy, mirror, purge Files and Folders.

Read more