Get started Bring yourself up to speed with our introductory content.

How to install the JDK on Windows and set up JAVA_HOME

Is it time to install the latest Java release? Here is a quick look at how to get Java running on Windows, how to set up JAVA_HOME and how to configure the Java path setting as well.

Java 10 is now available, and while the new feature set isn't extremely long, developers may want to try the type...

inferences for local variables or the new class data sharing feature. If you want to dive into the Java 10 features list, you'll need to download and install the JDK and set up JAVA_HOME. For Windows, you'll likely want to edit the Java path setting as well. This tutorial will demonstrate how to do that.

Step 1: Download the JDK from Oracle

Oracle is the source of reference for the Java Development Kit, so the first step is to download the appropriate JDK for your OS -- be it Linux, macOS or Solaris. This tutorial installs Java on Windows. So, first, accept the Oracle license agreement, and then, choose the x64 package for Windows to download.

download jdk
Figure 1. Download the JDK from the Oracle website.

Step 2: Install Java on Windows

After the Java 10 download completes, the next step to install the JDK is to double-click on the executable and bring up the installation wizard.

It makes sense to accept all of the installation defaults the wizard presents, with the exception of where to install the JDK on the file system. The default is a subfolder under C:\Program Files, but the space between Program and Files can sometimes cause problems with Groovy scripts or Jenkins jobs. It's best to install the JDK into a folder of your own choosing that doesn't have empty spaces. For this tutorial, we will choose C:\_jdk10.

install jdk
Figure 2. Choose a folder for the JDK installation.

Step 3: Set up JAVA_HOME on Windows

Many programs, such as Tomcat and Gradle, search for the JAVA_HOME environment variable when they start up in order to boot with the appropriate Java Runtime Environment (JRE). On Windows, to set up the JAVA_HOME variable, bring up the System Properties tool located in the Control Panel. Click the Environment Variables button, and add a new system variable. Name that variable JAVA_HOME, and it'll point to the folder in which you installed the JDK. In this case, the variable value is C:\_jdk10.

Set up Java
Figure 3. Set up JAVA_HOME on Windows.

Step 4: Configure the Java path setting

In order for Java tools, like Javac.exe and Javadoc.exe, to be accessible anywhere on the file system, you need to add the bin of the Java 10 installation, which contains all of these executables, to the Windows path. The Path variable already exists in Windows, so all you need to do is highlight the Path variable in the same window in which we did the JAVA_HOME setup. Then, select the edit button, add a semicolon to the end of the existing path and then provide the location of the JDK bin directory, namely C:\_jdk10\bin.

edit java
Figure 4. Edit the Java path setting.

Step 5: Verify the JDK installation

After the JDK is installed on Windows, the JAVA_HOME setup is complete, and you've configured the Java path setting. The last thing you need to do is verify the Java 10 installation actually works. To do so, simply open up a command prompt, and enter the following command:

>java.exe -version

If the output indicates you are using Java version 10 and the JRE is version 18.3, then you have installed the JDK successfully.

verify jdk
Figure 5. Verify the JDK installation.

You might find the 18.3 label a little strange given the fact that Java 10 was just installed, but this number is part of the new Java versioning scheme that uses the year and the month the release came out. Since Java 10 was released in March 2018, it receives an 18.3 label.

And that's it. If you followed these steps, you have successfully installed the JDK and configured the JAVA_HOME variable and the Java path setting on Windows.

This was last published in April 2018

Dig Deeper on JSRs and APIs

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

What new feature of Java 10 is most likely to get you to install the JDK on your local machine?
Cancel

-ADS BY GOOGLE

SearchCloudApplications

SearchSoftwareQuality

SearchHRSoftware

SearchSAP

SearchERP

DevOpsAgenda

Close