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-XXC:\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_HOMEVariable 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