Open Windows Explorer.
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
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.
In the Advanced tab of System Properties select the Environment Variables... button in the lower right corner of the window.
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.
Scroll down the list of System Variables and select the Path
variable.
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 thePath
variable selected. Add%JAVA_HOME%\bin;
to the beginning of thePath
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.
cmd
and pressing 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
.