Step 1. Remove all PATH entries pointing to any JDK. For example:
Step 2. Remove all PATH entries pointing to javapath. For example:
Step 3. Set environment variable JAVA_HOME pointing to the required JDK. For example:
Use either the Environment variables applet in Windows Settings, or the command line:
Example:
Step 4. Prepend the PATH entry for the version 1.8 of Java with %JAVA_HOME%\bin.