Installing the Java Development Kit Core Java

The most complete and up-to-date versions of the Java Development Kit (JDK) are available from Sun Microsystems for Solaris, Linux, and Windows. Versions in various states of development exist for the Macintosh and many other platforms, but those versions are licensed and distributed by the vendors of those platforms.

NOTE: Some Linux distributions have prepackaged versions of the JDK. For example, onUbuntu, you can install the JDK by simply installing the sun-java6-jdk package with apt-get orthe Synaptic GUI.

Downloading the JDK

Java Jargon

Java Jargon

You already saw the abbreviation JDK for Java Development Kit. Somewhat confusingly, versions 1.2 through 1.4 of the kit were known as the Java SDK (Software Development Kit). You will still find occasional references to the old term. There is also a Java Runtime Environment (JRE) that contains the virtual machine but not the compiler. That is not what you want as a developer. It is intended for end users who have no need for the compiler.

Next, you’ll see the term Java SE everywhere. That is the Java Standard Edition, in contrast to Java EE (Enterprise Edition) and Java ME (Micro Edition).

You will occasionally run into the term Java 2 that was coined in 1998 when the marketing folks at Sun felt that a fractional version number increment did not properly communicate the momentous advances of JDK 1.2. However, because they had that insight only after the release, they decided to keep the version number 1.2 for the developmentkit. Subsequent releases were numbered 1.3, 1.4, and 5.0. The platform, however, wasrenamed from Java to Java 2. Thus, we had Java 2 Standard Edition Software Development Kit Version 5.0, or J2SE SDK 5.0.

For engineers, all of this was a bit confusing, but that’s why we never made it into marketing. Mercifully, in 2006, sanity prevailed. The useless Java 2 moniker was dropped and the current version of the Java Standard Edition was called Java SE 6. You will still see occasional references to versions 1.5 and 1.6—these are just synonyms for versions 5.0 and 6.

Finally, when Sun makes a minor version change to fix urgent issues, it refers to the change as an update. For example, the first update of the development kit for Java SE 6 is officially called JDK 6u1 and has the internal version number 1.6.0_01.

If you use Solaris, Linux, or Windows, point your browser to to download the JDK. Look for version 6 or later and pick your platform. Don’t worry if the software is called an “update.” The update bundles contain the most current version of the whole JDK.

Sometimes, Sun makes available bundles that contain both the Java Development Kit and an integrated development environment. That integrated environment has, at different times of its life, been named Forte, Sun ONE Studio, Sun Java Studio, and Netbeans. We do not know what the eager beavers in marketing will call it when you approach the Sun web site. We suggest that you install only the Java Development Kit at this time.

Only the installation and compilation instructions for Java are system dependent. Onceyou get Java up and running, everything else in this book should apply to you. System independence is a major benefit of Java.

Setting the Execution Path

After you are done installing the JDK, you need to carry out one additional step: Addthe jdk/bin directory to the execution path, the list of directories that the operating system traverses to locate executable files. Directions for this step also vary among operating systems.

  • In UNIX (including Solaris and Linux), the procedure for editing the execution pathdepends on the shell that you are using. If you use the C shell (which is the Solarisdefault), then add a line such as the following to the end of your ~/.cshrc file:
    set path=(/usr/local/jdk/bin $path)
    If you use the Bourne Again shell (which is the Linux default), then add a line suchas the following to the end of your ~/.bashrc or ~/.bash_profile file:
    export PATH=/usr/local/jdk/bin:$PATH
  • Under Windows, log in as administrator. Start the Control Panel, switch to ClassicView, and select the System icon. In Windows NT/2000/XP, you immediately get thesystem properties dialog. In Vista, you need to select Advanced System Settings. In the system properties dialog, click the Advanced tab, then click on the Environment button. Scroll through the System Variables window until you find avariable named Path. Click the Edit button. Add the jdkbin directoryto the beginning of the path, using a semicolon to separate the new entry, like this:
    c:jdkbin;other stuff

Save your settings. Any new console windows that you start have the correct path. Here is how you test whether you did it right: Start a shell window. Type the linejava -version

and press the ENTER key. You should get a display such as this one:
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

If instead you get a message such as “java: command not found” or “The name specifiedis not recognized as an internal or external command, operable program or batch file”,then you need to go back and double-check your installation.

Launching the system properties dialog in Windows Vista

Launching the system properties dialog in Windows Vista

Setting the Path environment variable in Windows Vista

Setting the Path environment variable in Windows Vista

Installing the Library Source and Documentation

The library source files are delivered in the JDK as a compressed file, and youmust unpack that file to get access to the source code. We highly recommend that youdo that. Simply do the following:

  1. Make sure the JDK is installed and that the jdk/bin directory is on the execution path.
  2. Open a shell window.
  3. Change to the jdk directory (e.g., cd /usr/local/jdk1.6.0 or cd c:jdk1.6.0).
  4. Make a subdirectory src
    mkdir src
    cd src
  5. Execute the command
    jar xvf ../
    (or jar xvf on Windows)

TIP: The file contains the source code for all public libraries. To obtain even more source (for the compiler, the virtual machine, the native methods, and the private helper classes), go to

The documentation is contained in a compressed file that is separate from the JDK.You can download the documentation from http: //java .sun .com /javase /downloads. Simply follow these steps:

  1. Make sure the JDK is installed and that the jdk/bin directory is on the execution path.
  2. Download the documentation zip file and move it into the jdk directory. The file iscalled, where version is something like 6.
  3. Open a shell window.
  4. Change to the jdk directory.
  5. Execute the command
    jar xvf
    whereversion is the appropriate version number.

Installing the Core Java Program Examples

You should also install the Core Java program examples. You can download them from proper website. The programs are packaged into a zip file corejava .zip. You should unzip them into a separate directory —we recommend you call it CoreJava Book. Here are the steps:

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Core Java Topics