Java Home Path Setup - Windows

โ 1. Find Your Java Installation Path
Typically, Java is installed in one of the following locations:
C:\Program Files\Java\jdk-XX
C:\Program Files (x86)\Java\jdk-XX
Replace jdk-XX
with your installed JDK version (e.g., jdk-17
, jdk-21
, etc.).
โ 2. Set JAVA_HOME (System Environment Variable)
๐น Method: Through System Properties
Press Windows + S, type "Environment Variables", and click "Edit the system environment variables".
In the System Properties window, click Environment Variables.
Under System variables, click New:
Variable name:
JAVA_HOME
Variable value: (Your JDK path, e.g.,
C:\Program Files\Java\jdk-21
)
Click OK.
โ 3. Add to PATH (optional but recommended)
Still in the Environment Variables window:
Under System variables, find and select
Path
, then click Edit.Click New, and add:
%JAVA_HOME%\bin
โ 4. Verify It Works
Open Command Prompt and run:
echo %JAVA_HOME%
You should see the path to your JDK.
Then verify Java:
java -version
javac -version
Subscribe to my newsletter
Read articles from V A S G Reddy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
