Home > Java Installation & Configuration > Java Installation & Configuration

Java Installation & Configuration



Java is freely downloadable from Sun’s website (http://developers.sun.com/downloads/) . What’s to decide is which version to chose? At the time of this post, recommended Java versions are 1.4 , 1.5 and 1.6. While Java 1.4 has been in the field for quiet few years and personified as a de-facto across wide range of applications and industry choice, Java 1.5 has made its advent to an extent that many Java applications across the globe are now migrating to 1.5. Reason being simple, Java is backward compatible and richer features of Java 1.5. While Java 1.4 has persisted to demonstrate reliability, Java 1.5 has proved to be more plenteous. Relatively recent arrival of Java 1.6 has its share of the buzz with more features in the kit. Now, we have a sneak peak into Java 1.7 available as well. With every new release, new features in Java will be explored. As this post’s focus is on the installation/configuration facet, we shall keep the discussion of java versions, features, pros & cons as an open topic.

Many times, there’s confusion about PATH / CLASSPATH/ JAVA_HOME variables. What they actually are and how they matter? Or if its really necessary to set them, if so how to set them? Below we try to answer all the questions that matter.

The following sections describe:-

  • Downloading Instructions – Describes where and what to to download.
  • Installing Instructions – Describes how to install Java into a location in the computer.
  • Configuration Instructions – Describes how to set up a computer to write java programs and also execute them.


In brief:

  • Download Java (JDK – if you want to write and run your own java programs / JRE – if you only want to run java programs) from Sun’s website. (Chose your java version)
  • Once downloaded, install Java to any location on your computer
  • Set environment variables (PATH / CLASSPATH / JAVA_HOME – all optional and set for convinience) in your computer.
  • Set PATH to (java installed location)/JDK_verstion/bin (optional)
  • Set CLASSPATH to (java installed location)/JDK_verstion/lib/tools.jar (optional)
  • Set JAVA_HOME to (java installed location)/JDK_verstion (optional)

If you are using any IDE for working on java, you dont even have to set the environment variables, as the IDE itself ships with a support for a Java version. You have to set the environment variables most likely in situations like:

  • You want to work with simple text editors like notepad
  • You want to work with certain java dependant softwares like Ant, Glassfish, Tomcat etc which need java environment variables to be set.

Refer below detailed description for more information.



Downloading Instructions:

Java can be downloaded freely from Sun’s website as its as a free software under the GNU General Public License . If you want write your own Java programs (.java files), then it needs to be compiled first and then run. For this, you must download the SDK (Software Developers Kit). If you just want to to run a Java program that has already been compiled (.class file), then you can just need to download the JRE (Java Runtime Environment). Once you have decided what you need, download either the SDK or the JRE. Choose the download that is suitable for your operating system.

From the main site, http://java.sun.com, select downloads link, in the drop down select JavaSE for downloading either the latest Java version with update alone, or with JavaEE, or with JavaFX SDK, or JDK with NetBeans, or JRE with update alone, or JDK documentation, or JDK source code. Select the downloadable that’s more suitable for your requirement and for your operating system. Download the installer executable to any location in the computer,

Most of the applications or technologies today have been upgraded to work with JDK 1.5 and it can be directly downloaded from http://java.sun.com/javase/downloads/5/jdk, else a registration form has to be filled up, as will be shown below. Follow the video for instructions on downloading Java.


Follow the video below for download instructions:


Vodpod videos no longer available.



Installation Instructions:

1. Check the download file size (Optional)

If you save the self-installing executable to disk without running it from the download page at the web site, notice that its byte size is provided on the download page. Once the download has completed, check that you have downloaded the full, uncorrupted software file.

2. If 5.0 Beta 1, Beta 2 or RC is installed, uninstall it.

Use the Microsoft Windows Add/Remove Programs utility, accessible from the Control Panel (Start -> Settings -> Control Panel).

3. Run the JDK installer

The file jdk_<version>-windows-i586-i.exe is the JDK installer. If you downloaded it instead of running it directly from the web site, double-click on the installer’s icon. Then follow the instructions the installer provides. Chose any location on the computer to install. The installer may ask you to reboot your computer. When done with the installation, you can delete the download file to recover disk space.

Note — Trying to install the JDK on a non-supported version of Microsoft Windows or on a machine that doesn’t have a sufficiently up-to-date Service Pack will cause the installer to generate this warning: “We recommend that you do not install this Java platform for the following reasons: This Java platform does not support the operating system or operating-system service pack on this machine.” See the system requirements above for information on supported configurations of Microsoft Windows.

Installed Directory Tree
The JDK has the directory structure shown below.

| | | | | | | | |
| | | | bin lib | demo |
| | | LICENSE | | | jre
| | COPYRIGHT | __|__
| README.txt include | |
readme.html bin lib

In addition, the Java Plug-in and Java Web Start will automatically be installed.

4. Open a command prompt, type ‘java –help’ command, and enter, the command should be recognized and will display help options available for java in command prompt. If so, Java is successfully installed in your computer.


Follow the video below for install instructions:

Vodpod videos no longer available.



Configuration Instructions:

After following the instructions above, Java has been successfully installed on your computer. If you have installed the SDK, then you can compile Java programs by typing “javac” command and run java programs by typing “java” command in the command prompt from the Java installation directory. If you have installed JRE alone, then you will be able to only run the java programs by typing “java” command.

You may find it convenient to add this installed location to your operating system’s environment variables, otherwise you will need to explicitly refer to the absolute location of java every time.

There are different ways to configure the java installation :

  • Through environment variables
  • Through command prompt


Setting PATH / CLASSPATH variables through environment variables:

1. Update the PATH variable: (Optional)

You can run the JDK without setting the PATH variable, or you can optionally set it as a convenience.

  • Should I set the PATH variable?
    Set the PATH variable if you want to conveniently run the JDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command. If you don’t set the PATH variable, you need to specify the full path to the executable every time you run it, such as:

C:>”\Program Files\Java\jdk_<version>\bin\javac” MyClass.java
It’s useful to set the PATH permanently so it will persist after rebooting.

  • How do I set the PATH permanently?
    To set the PATH permanently, add the full path of the jdk_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk_<version>\bin.

Set/Edit PATH through Windows environment variables:

  1. Right click on the My Computer icon on your desktop and select properties
  2. Click the Advanced System Settings
  3. Click the Environment Variables button
  4. Under System/User variables, check for a variable named path.
  5. If path already exists, click on edit to update.
  6. Go to the end of the entries in variable value, add semi-colon ; and add (installed location)/JDK as the value.
  7. If path doesn’t exist, then click new on system/user variables
  8. Enter the variable name as path.
  9. Enter the variable value as the (installed location)/JDK
  10. Click OK

A typical value for PATH is:

C:\Program Files\Java\jdk_<version>\bin
Capitalization doesn’t matter. “OK” or “Apply”.

The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows looks for programs in the PATH directories in order, from left to right. You should only have one bin directory for a JDK in the path at a time (those following the first are ignored), so if one is already present, you can update it.

The new path takes effect in each new Command Prompt window you open after setting the PATH variable.

 2. Set the JAVA_HOME variable: (Optional)

If JAVA_HOME variable is set, then you can set other variables such as PATH, CLASSPATH etc in reference to the JAVA_HOME variable:

set path=%JAVA_HOME%\bin;%path%
set classpath= .;%JAVA_HOME%\lib;

Set/Edit JAVA_HOME through Windows environment variables:

  1. Right click on the My Computer icon on your desktop and select properties
  2. Click the Advanced Sytem Settings
  3. Click the Environment Variables button
  4. Under System Variable, click New
  5. Enter the variable name as JAVA_HOME
  6. Enter the variable value as the install path for the Development Kit
  7. Click OK

JAVA_HOME basically points to the location where JDK is installed. Ex:- JAVA_HOME – (C:\Program Files\Java\jdk1.5.0_19)


Setting PATH / CLASSPATH variables through command prompt:

Determining the current values of PATH and CLASSPATH:

Type these commands in a command window:
echo %PATH% or set PATH

If you get the message “echo is on” for either of these, then that particular variable has no value (it has not yet been set).

set PATH=;C:\Program Files\Java\jdk_<version>\bin; –> This will add the entry to the PATH variable.
set CLASSPATH=C:\Program Files\Java\jdk_<version>\lib –> This will add the entry to the CLASSPATH variable.


set PATH=%JAVA_HOME%\bin;%path%


Follow the video below for configuration instructions:

Vodpod videos no longer available.



  • Setting PATH, CLASSPATH and JAVA_HOME variables are all optional. All these variables have different purposes to serve and are set for convenience. Sometimes, few softwares dependant on Java installation (Ex: Tomcat, Glassfish, ANT etc)require few of these variables to be set, at that time, you can chose to set them as well.
  • If you will be using an IDE (Integrated development environment) such as Eclipse / MyEclipse, NetBeans etc, it will either ask you which JDK to use or find it by itself, so you don’t even need to set environment variables at all.

Your computer should now be ready to use the JDK. You can also download the JDK documentation (which includes API pages that explain in detail about each Java class that can be used) and the source code from the JDK download page. Start using the JDK!



Following is  Sun’s Java Installation Video: 


 Vodpod videos no longer available.


 or follow the instructions from Sun in the following document: 






Source: Sun Microsystems Educational Services Course – Introduction to java programming language WJ-1101A





Note: Refer to other posts in Java category for further knowledge.



  1. java jobs
    April 21, 2010 at 5:44 pm

    very informative

  2. Memento
    February 8, 2010 at 7:39 am

    Thank god..
    You can’t imagine how many threads on websites I had to read only to find this information :

    Paths to set :

    Set PATH to C:\Program Files\Java\jdk1.6.0_18\bin

    Set CLASSPATH to C:\Program Files\Java\jdk1.6.0_18\lib\tools.jar

    Set JAVA_HOME to C:\Program Files\Java\jdk1.6.0_18

    This journey wich ended to your website cost me 5 hours.. !

    You cannot imagine how much bullshits I read on other websites so called PRO !
    “Amateurs” like we say in my country..

    Bonne nuit !

  3. Pranava
    September 19, 2009 at 11:55 pm

    This website is really amazing and helpful. I would like to thank the author for providing such detailed and collective information regarding all the emerging technologies at one place. It becomes very helpful for anyone to find all required & relevant information to start with configuration and learning basics of any technologies.

  4. anantha
    August 19, 2009 at 11:37 am

    Now as in when SUN releasing new versions of java, industries using java in the core products have to upgrade and this is a very slow progress. Though Java 1.7 is released now, but the extended technologies are still in the process of catching up with Java 1.5. But that Java is backward compatible, it should make this process a little easy.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: