In order to set up the environment variables, first, you need to download and install the latest JDK version. You can download this from here: https://goo.gl/Djcyjp.
You can look for the file according to your system configurations.

Once you are done, you can find the Java root folder here: C:\Program Files
Now to set the environment variables:
- 
Right click on “My Computer” and go to the properties.
 
- 
In System properties windows, click on the Advanced tab.
 
- 
In this tab, click on” Environment Variables”.
 
- 
Click on new to add new variable:
 
- 
Now add the below variables one by one:
- 
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_112
 
- 
JDK_HOME  : %JAVA_HOME%
 
- 
JRE_HOME  : %JAVA_HOME%\jre
 
- 
CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
 
- 
PATH      : your-unique-entries;%JAVA_HOME%\bin
 
 
- 
Once done, click on “OK” and exit.