W3docs

How to set java_home on Windows 7?

To set the JAVA_HOME environment variable on Windows 7, follow these steps:<br>

To set the JAVA_HOME environment variable on Windows 7, follow these steps:

1. Set the JAVA_HOME variable

  1. Right-click on "Computer" and select "Properties".
  2. In the "System Properties" window, click on the "Advanced" tab.
  3. Click on the "Environment Variables" button.
  4. Under "System Variables", click on "New".
  5. In the "New System Variable" window, enter JAVA_HOME in the "Variable name" field and the path to the Java installation directory in the "Variable value" field (e.g., C:\Program Files\Java\jdk1.8.0_211).
  6. Click "OK" to close all windows.

2. Update the Path variable

  1. In the "Environment Variables" window, scroll down under "System Variables", find Path, and click "Edit".
  2. Move the cursor to the end of the existing value, add a semicolon (;), and append the path to the Java bin directory (e.g., C:\Program Files\Java\jdk1.8.0_211\bin).
  3. Click "OK" to close all windows.

3. Verify the configuration Open a new Command Prompt and run:

echo %JAVA_HOME%
java -version

You should see the JDK path and the installed Java version.

Note: Windows 7 has reached end-of-life. On Windows 10/11, the steps are similar, but the interface differs slightly (right-click "This PC" > Properties > Advanced system settings).

I hope this helps! Let me know if you have any questions.