This post demonstrates how to install Oracle JDK8 on Windows 10.
Download JDK8 From Oracle
First, go to www.google.com and search for “Java JDK 8”. Then, click the link that says “Java SE Development Kit 8 – Downloads“.
Once you’re on the Oracle page, scroll down until you reach the section with the “Windows x64” download link as shown below. Click the link to download the Oracle JDK 8 to your system.
Then, you may need to review and agree on the Oracle Technology Network License Agreement for Oracle Java SE.
To proceed, click the checkbox and the button.
Install Oracle JDK8 on Windows 10
Once you downloaded the installer, double-click it to start the setup process.
Then, the following window shows up.
Then, click Next.
Then, click Next again.
Finally, click Close. Now, we have installed Oracle JDK8 on Windows 10.
Configure JAVA_HOME and PATH
The final step of the installation is the configuration of JAVA_HOME and PATH environment variables. Go to System Properties and click the Environment Variables button.
Then, click New.
Then, add the JAVA_HOME environment variable accordingly. Then, click the OK button.
Then, update the PATH environment variable. Click Edit.
Then, click New to add a new row and put in %JAVA_HOME%. Then, click the OK button.
Finally, we have configured the two environment variables.
An alternative way to Configure JAVA_HOME and PATH
Sometimes we don’t have the permissions to add or update environment variables. To go around that, we can set environment variables in MS-DOS that are valid only for the command-line window’s session.
Consider the following problem. When we run the javac command, we encounter the issue below.
To fix this, we can run these MS-DOS commands to set up environment variables for that session only.
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_261
set PATH=%PATH%;C:\Program Files\Java\jdk1.8.0_261\bin
This alternative configuration for Oracle JDK8 is useful when we want to switch between different JDKs easily. In fact, we don’t need an installer. We could download a zip format distribution, if available, and just extract the binaries somewhere.
This post is part of a reboot Java tutorial.