First, you will want to download the most recent version of the JDK from Oracle, then run the installer. Take note where the installer puts Java (should be something like c:/program files/java/jdk-12.0.01)
Next you want to add Java to your path. Navigate to your system’s environment variables config (Control Panel > System and Security > System > Advanced System Settings > Environment Variables). Select
Path from the list of User Variables, and then click Edit. Select New > Browse, and then nagivate to where Java was installed, click inside the jdk folder and select the folder called
Now click Ok twice until you are back at the main Environment Variables window. Now, under User variables, select new. Give the variable the name
JAVA_HOME and for the value, select Browse. Navigate and select the JDK folder (should look like
jdk-12.0.01 for example).
Your PC may require a reboot for the changes to take effect. Once you reboot, you can test to make sure you’ve configured this correctly by opening the terminal and running
java -version and