Skip to main content
IST-ASAG
 

Java SE Installation Instructions

Audience

Windows users who do not have the Java SE (Java Platform, Standard Edition) JDK (Java Development Kit) installed on their workstation; or those who want to install a different version of Sun's Java SE.

Purpose

To install the Java SE JDK as a foundation for running Java applications and developing J2EE components.

Prerequisites

These are the basics; if your machine isn't running these, please install or upgrade as appropriate:

  • Operating System: Upgrade to latest stable, high-encryption releases of Windows
  • Web Browser: It will be useful to have a current version of FireFox. If you also use other browsers, they should also be upgraded to recent, stable versions.

Installing Java on a Windows Box

These instructions will help you to install the Java SE JDK on a Windows workstation. These instructions describe installation of Java SE v. 5.0, but may be generalizable to other versions.

Download Java

Download the version of Java you plan to install from Sun's website.

  • The Java(TM) 5 Standard Edition (J2SE) Development Kit (JDK) installation includes an enormous library of Java classes, and the Java Runtime Environment (JRE) that allows compiled Java classes to run.
  • On the J2SE download page, click the "Download" link for the latest JDK release - JDK 5.0 Update 8 as of 7 Sep 2006 - then (after accepting the license agreement), click the link for the Windows (offline installation, multi-language)
  • Save the executable file to a temporary directory on your local disk.
    • the filename will be something like: jdk-1_5_0_08-windows-i586-p.exe
    • it's a big file -- about 50 MB

Install Java

Warning
It is strongly advised that you choose an installation directory that does not include spaces in the path name (e.g., do NOT install in C:\Program Files\). If Java is installed in such a directory, it is critical to set the JAVA_HOME environment variable to a path that does not include spaces (e.g., C:\Progra~1\); failure to do this will result in exceptions thrown by some programs that depend on the value of JAVA_HOME.
  • Run the executable downloaded above.
  • Change the installation directory to a path with no spaces in it, such as C:\jdk_1.5.0_08 (recommended; cf. warning, above).
  • Accept all other installation defaults.
  • When the installer gets to the stage of installing the J2SE Runtime Environment it is okay to accept the default, e.g., C:\Program Files\Java\jre1.5.0_08. During this stage of the installation, it may be necessary to close some applications - e.g., Eclipse - that are running in a previously-installed version of the JRE; the installation program should prompt appropriately.
  • Instructions for setting PATH and CLASSPATH and JAVA_HOME are given in summary below; in more detail in an appendix to this document; and also on Sun's site.
    • Add Java's bin directory (e.g., C:\jdk_1.5.0_08\bin) to your PATH environment variable (more info in the Environment Variables appendix on this page). Make sure that references to older Java installations do not conflict with the new version you have installed (e.g., if installation of an Oracle client placed a reference to an old version of Java in your path you may need to do some careful experimentation and tweaking to appropriately set your path so all the applications you need will run).
    • Set your CLASSPATH environment variable:
      • CLASSPATH should be set to "." (a period, and nothing more), unless you know that for some reason you need additional items in your CLASSPATH.
      • The theory here is that to include any user classes, you can use the -classpath command line switch with java, javac, javadoc and other tools; and CLASSPATH is not forced for multiple applications; alternately you can add more paths to CLASSPATH as necessary.
      • More about how to set the CLASSPATH can be found in the Environment Variables appendix on this page.
    • An environment variable called JAVA_HOME should be set to the root directory of your Java installation, e.g., C:\jdk_1.5.0_08. Please refer to the warning, above, re: installations to directories with spaces in the path name!

Test Java Installation

Make sure your Java SDK installation works by compiling a simple class. You can use Sun's generic HelloWorld application if you like. Use javac from a Command prompt to compile the class.

Appendix: Setting Environment Variables (PATH and CLASSPATH)

This section outlines how to set environment variables on a Windows 2000 box (the process is similar under NT and XP). Examples are given for setting PATH and CLASSPATH, environment variables that need to be set properly in order to run the Java(TM) 5 JDK.

  • Windows uses two flavors of Environment Variables (EVs): System EVs and User EVs.
    • System EVs can only be set by a user with Administrator privleges
    • System EVs are set for any user who logs in on the machine.
    • User EVs apply only to the user who set them.
    • User EVs take precedence over System EVs of the same name; however for the PATH environment variable, the user PATH is appended to the system PATH rather than superceding it.
  • To edit or create EVs follow these steps:
    • From the Start menu, go to: Settings:Control Panel:System
    • Select the Advanced tab
    • Edit the desired EV:
      • If it already exists, select the desired EV from the User or System list (whichever is applicable; see above); then click the Edit button
      • If the EV you want to edit doesn't exist, add it by clicking the New button.
  • Example: include Java installation directory in PATH
    • Edit or create the appropriate PATH environment variable (as above)
    • Append the Java bin directory (e.g., C:\jdk_1.5.0_08\bin) to the end of the existing path: %SystemRoot%\system32;[...];C:\jdk_1.5.0_08\bin
    • Note that paths are separated from each other with semicolons ( ; )
    • The new path takes effect in each new Command Prompt window or other application opened after setting the PATH environment variable.
  • Example: Setting the CLASSPATH
    • Edit or create the CLASSPATH environment variable (as above)
    • Unless you know it ought to be otherwise (and especially if you are just creating the CLASSPATH environment variable upon installation of the Java SDK), set the value of CLASSPATH to be a single period: .
    • When multiple paths are included in CLASSPATH, separate them from each other with semicolons ( ; ), just as shown for PATH, above.
  • You can now Confirm your Java installation was successful