Prerequisites
- Java Installed location
- windows operating system
Step 1
Copy jdk home path
example: C:\Program Files\Java\jdk1.8.0_171
Step 2
Open My computer

Step 3
Right Click This PC

Step 4
Click on Properties

Step 5
Click on Advanced system settings

Step 6
Click on the Environment variables

Step 7
Click New on the System variables column

Step 8
Enter Variable name as JAVA_HOME
Enter Variable value as C:\Program Files\Java\jdk1.8.0_171
click ok
Note :
Variable name should be CAPS
Variable value should be as your java installed path
don’t copy until bin folder

Step 9
After Click OK
we can see the JAVA_HOME variable in environment variables

Step 10
now we need to need to add this JAVA_HOME to Path variable
Search for Path variable in same system variables window

Step 11
After selecting Path variable
Click on Edit button
Step 12
Edit environment variable dialog box will appear
Click on the New button

Step 13
Text box will appear on the list
add %JAVA_HOME%\bin in the text box

Step 14
Click OK after adding %JAVA_HOME%\bin
Now close all the windows
Step 15
We can verify by below steps
open the command prompt
type java -version
