Java is a computer programming language that is concurrent, class-based and object-oriented. It was originally developed by James Gosling at Sun Microsystems. Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture.
Java is currently owned by the Oracle Corporation which acquired Sun Microsystems in 2010. Following tutorial will show you how to setup and configure Java 1.6 on your Windows computer so you can develop and run Java code.
JDK Download & Install
Java can be downloaded from the Oracle Java download page. There are a number of different download packages available, for this tutorial we will be installing Java Standard Edition (SE) on Windows. In order to be able to compile Java code we need the Java Development Kit (JDK) package that comes with a Java compiler. The JDK package also comes with a Java runtime environment (JRE) that is needed to run compiled Java code.
For this tutorial we will use an older Java version which can be obtained by scrolling all the way down to the bottom of the page and clicking on the Previous Releases - Java Archive link. Look for the Java SE 6 link and after clicking on it select Java SE Development Kit 6u45.
You can find here the direct link to download the jdk1.6.0_45 installer for windows 32 or 64 bit.
Accept the License Agreement and pick the correct download for your operating system. In this example we will use the Windows 64 bit version.
Sign in using your Oracle account (or create a new one) and the download should start. Once the download is complete, locate the jdk-6u45-windows-x64.exe file and double click to run the installer.
Click Next and on the following screen optionally change the installation location by clicking on the Change... button. In the example below the install location was change to 'C:\Java\jdk1.6.0_45'. From now on we will refer to this directory as: [java_install_dir].
Click Next and then Close after the installer successfully finished installing Java.
In order for Java applications to be able to run we need to setup a 'JAVA_HOME' environment variable that will point to the Java installation directory. In addition if we want to run Java commands from a command prompt we need to setup the 'PATH' environment variable to contain the Java bin directory.
When using Windows the above parameters can be configured on the Environment Variables panel. Click on the Windows Start button and enter “env” without quotes as shown below.
Environment variables can be set at account level or at system level. For this example click on Edit environment variables for your account and following panel should appear.
Click on the New button and enter “JAVA_HOME” as variable name and the [java_install_dir] as variable value. In this tutorial the installation directory is 'C:\Java\jdk1.6.0_45'. Click OK to to save.
Click on the New button and enter “PATH” as variable name and “%JAVA_HOME%\bin” as variable value. Click OK to save.
Note that in case a 'PATH' variable is already present you can add “;%JAVA_HOME%\bin” at the end of the variable value.
The result should be as shown below. Click OK to close the environment variables panel.
In order to test the above configuration, open a command prompt by clicking on the Windows Start button and typing “cmd” followed by pressing ENTER. A new command prompt should open in which the following command can be entered to verify the installed Java version:
The result should be as shown below.
This concludes the setting up and configuring JDK 1.6 on Windows. If you found this post helpful or have any questions or remarks, please leave a comment.