How to Install Java SDK on Windows

java_windows_sA lot of Java-based development tools require Java SDK as the dependency. This post will provide the guide on how to install Java SDK from Oracle on Windows, especially Windows 7. An additional configuration step is also included so that Java will be immediately ready for use by dependent applications.

Java SDK installation on Windows is apparently very straightforward. Oracle already provides a page explaining the Java SDK installation steps. This post focuses on step-by-step guide with necessary snapshot images to deliver better clarity on the installation process.

Java SDK Installation

1. Download Java SDK from the download page

Java SDK download page URL is http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Oracle has released Java JDK 8 that provides improvement over the previous Java JDK 7. However, in this post we will choose Java JDK 7 since some popular libraries that we will use later may have not officially supported Java 8. To download JDK 7, click JDK download button from the Java SE 7uXX section and choose the binary version to download (32-bit or 64-bit).

2. Go to the download directory and run the installer to complete the installation

The installer wizard guides the rest of installation. By clicking Next, Java SDK will be installed to the default directory, which is C:\Program Files\Java for the 64-bit version or C:\Program Files x86)\Java for the 32-bit version.
The following snapshots show the windows in the wizard when default installation is chosen for Java JDK 7u67 64-bit:

Java SDK installer wizard first screen

Java SDK installer wizard: First screen

Java SDK installer wizard: component selection and install directory  location

Java SDK installer wizard: Component selection and install directory location

Java SDK installer wizard: installation process

Java SDK installer wizard: Installation process

Java SDK installer wizard: JRE installation

Java SDK installer wizard: JRE installation

Java SDK installer wizard: Finishing installation

Java SDK installer wizard: Finishing installation

Java SDK Configuration and Verification

1. Set JAVA_HOME variable that points to the Java SDK installation directory.

From our previous snapshots, JAVA_HOME will be set to “C:\Program Files\Java\jdk1.7.0_67”. The path can be different across installations. To set JAVA_HOME variable, we do the following steps:
a. From taskbar, click Windows icon and right click on Computer. Choose Properties.

Selecting Properties from Computer menu in Windows startup menus

Selecting “Properties” from Computer menu in Windows startup menus

b. From Control Panel Home menus on the left, choose Advanced system settings

Advanced system settings menu in Control Panel Home

“Advanced system settings” menu in Control Panel Home

c. After the “System Properties” window pops up, choose Environment Variables

Environment variables button in the Advanced tab

“Environment Variables” button in the Advanced tab

d. Create a new environment variable named JAVA_HOME from the Environment Variables popup window. Since we are installing Java 7u67, we assign its installation directory as the JAVA_HOME value. When installation was made to a different directory, it should be set accordingly.

"New" buttton to create a new environment variable

“New” buttton to create a new system variable

Creating "JAVA_HOME" as a new system variable

Creating “JAVA_HOME” as a new system variable

e. Click OK to apply the change

2. Add bin directory of the Java JDK into the executable path.

a. From “Environment Variables” popup window, locate the variable Path in the System variables section and click Edit.

Variable "Path" in the System Variables section

Variable “Path” in the “System variables” section

b. Append %JAVA_HOME%\bin into the Path value. Don’t forget to prefix with semicolon to separate with the previous entry.

Java SDK binary directory addition into executable paths

Java SDK binary directory addition into executable paths

3. Verify Java SDK has been properly installed and configured

a. Press Windows + R and type cmd

Windows + R  + cmd

Windows + R  followed by “cmd” command

b. Type “echo %JAVA_HOME%” to verify the value of the assigned Java distribution

Verifying the value of Java environment variable

Verifying the value of Java environment variable

c. Type “java -version” and verify that the phrase “Java Hotspot(TM) 64-bit/32-bit Server VM” exists, which indicates that Java SDK has been successfully installed and configured properly

Java version for Java SDK

Java version for Java SDK

That’s all for the installation . If you are interested in knowing how the installation can be accomplished in a Linux box, this post can be helpful.

One thought on “How to Install Java SDK on Windows

  1. Pingback: Maven Tutorial for Beginners: Installation and Configuration « Amikelive | Technology Blog

Leave a Reply

Your email address will not be published. Required fields are marked *