How-To: Configure JAVA_HOME and update System Path for JRE
What Does This Article Cover? This guide provides detailed instructions on setting the JAVA_HOME
environment variable and updating the Path
system variable to ensure your system uses Java Runtime Environment (JRE). Correct configuration of these variables is crucial for running Java applications smoothly.
-
Setting the JAVA_HOME variable
-
Updating the System PATH
-
Verifying the Installation
-
Other Related Material
Setting the JAVA_HOME Variable
-
Access System Properties:
- Open the Start Menu and type
env
. - Select Edit the system environment variables.
- Open the Start Menu and type
-
Navigate to Environment Variables:
- In the System Properties window, click the Environment Variables button.
-
Create JAVA_HOME Variable:
- In the Environment Variables window, under the System variables section, click New.
- Enter
JAVA_HOME
as the variable name. - For the variable value, enter the path to your JRE installation directory. Ensure the JRE version is numbered is version 21 or higher.
- Click OK to save the variable.
Updating the System PATH
-
Edit the Path Variable:
- In the same Environment Variables window, under the System variables section, find and select the Path variable. Click Edit.
-
Add JAVA_HOME to Path:
- Click New and add
%JAVA_HOME%\bin
to the entries list. - Move this new entry above any other Java-related entries in the list to prioritize it.
- Click OK to close all dialog boxes.
- Click New and add
Verifying the Installation
-
Open Command Prompt:
- Open a new command prompt window.
-
Check Java Version:
- Type
java -version
and press Enter. Confirm that the version displayed is within the specified range (version 21 or higher). - Type
javac -version
and press Enter. Verify that this version also falls within the acceptable range.
- Type