Set a JAVA_HOME environment variable.
Right Click “My Computer” / “Computer” / “This PC” (depending on which version of Windows you are running) and select “Properties”. From here where the environment variables are differs based on which version of Windows you have. If on Windows 10 press “Advanced System Settings” and there is a button called “Environment Variables”.
You will have to restart explorer.exe or reboot for the changes to be picked up.
Java does not use the registry for JAVA_HOME.