A 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 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.
b. From Control Panel Home menus on the left, choose Advanced system settings
c. After the “System Properties” window pops up, choose Environment Variables
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.
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.
b. Append %JAVA_HOME%\bin into the Path value. Don’t forget to prefix with semicolon to separate with the previous entry.
3. Verify Java SDK has been properly installed and configured
a. Press Windows + R and type cmd
b. Type “echo %JAVA_HOME%” to verify the value of the assigned Java distribution
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
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.