Setting PATH and JAVA HOME after installing on Windows

suggest change


Setup steps

  1. Open Windows Explorer.
  2. In the navigation pane on the left right click on This PC (or Computer for older Windows versions). There is a shorter way without using the explorer in actual Windows versions: Just press Win+Pause
  3. In the newly opened Control Panel window, left click Advanced System Settings which should be in the top left corner. This will open the System Properties window.

Alternatively, type SystemPropertiesAdvanced (case insensitive) in the Run (Win+R), and hit Enter.

  1. In the Advanced tab of System Properties select the Environment Variables… button in the lower right corner of the window.
  2. Add a New System Variable by clicking the New… button in System Variables with the name JAVA_HOME and whose value is the path to the directory where the JDK was installed. After entering these values, press OK.
  1. Scroll down the list of System Variables and select the Path variable.
  2. CAUTION: Windows relies on Path to find important programs. If any or all of it is removed, Windows may not be able to function properly. It must be modified to allow Windows to run the JDK. With this in mind ,click the “Edit…” button with the Path variable selected. Add %JAVA_HOME%\bin; to the beginning of the Path variable.

It is better to append at the begining of the line because Oracle’s software used to register their own version of Java in Path - This will cause your version to be ignored if it occurs after Oracle’s declaration.

Check your work

  1. Open the command prompt by clicking Start then typing cmd and pressing Enter.
  2. Enter javac -version into the prompt. If it was successful, then the version of the JDK will be printed to the screen.

Note: If you have to try again, close the prompt before checking your work. This will force windows to get the new version of Path.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents