Setting %PATH% and %JAVA_HOME% after installing on Windows

suggest change

Assumptions:

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.
  3. Scroll down the list of System Variables and select the Path variable.
  4. 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:

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


Installing Java Standard Edition:
* Setting %PATH% and %JAVA_HOME% after installing on Windows

Table Of Contents
8 Arrays
10 Maps
11 Strings
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
97 Installing Java Standard Edition
98 Process
106 Modules
114 Applets
122 JNDI
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap