Setting up JAVA HOME variables

Note: Install JDK 1.8 and specify the Path to JDK 1.8 in the JAVA_HOME environment. JDK installation usually adds a path to the installation folder into JAVA_HOME by itself. You need to specify JAVA_HOME manually, in case there is a wrong Java specification inJAVA_HOME or you have JDK installed but you have not specified it.

For Windows users, the default directory is C:\Program Files\Java\jdk1.8.x_y, where x_y is the Java JDK 8 version.

To set the environment variables, do the following tasks:
  1. On your system, navigate to the C:\Program Files\Java\jdk1.8.x_y folder.
  2. Copy the path of the folder.
  3. Navigate to Control Panel > System > Advanced System Settings
  4. On the Advanced tab, click Environment Variables.
  5. Locate the System variables section.
  6. Click New.
  7. In the Variable name field, enter JAVA_HOME.
  8. In the Variable value field, paste the folder path you copied.
  9. Click OK.
  10. Open a new Command Prompt window.
  11. Run the command as follows:
    
    C:\Users\testuser>javac -version
    javac 1.8.0_121