chris - Fotolia
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.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
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.
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.
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.
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.
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:
If the output indicates you are using Java version 10 and the JRE is version 18.3, then you have installed the JDK successfully.
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.