Set JAVA_HOME environment variable on Windows 10
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:
- Windows 10
- 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).
Example:
JAVA_HOME = C:\Program Files\Java\jdk-19
- Identify the Java home directory, which is generally under
C:\Program Files\Java
directory.
- 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:
JAVA_HOME
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
Summary
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:
Related Posts
2023 Phoenix VMUG UserCon
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 moreRed Hat User Group Insights, Ansible Automation Platform, and ITSM Integration
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 moreRobocopy Examples
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