Notice: This material is excerpted from Special Edition Using Java, ISBN: 0-7897-0604-0. The electronic version of this material has not been through the final proof reading stage that the book goes through before being published in printed form. Some errors may exist here that are corrected before the book is published. This material is provided "as is" without any warranty of any kind.
by Joe Carpenter
Since Java is being billed as "Programming for the Internet", it makes the most sense that one would download the Java Developers Kit (JDK) off of the Internet. There are a number of ways of going about this, the easiest of which is to use your favorite World Wide Web browser to grab it from either the JavaSoft Web site, or one of the several mirrors. In this appendix, we'll cover the basics of downloading the JDK from the JavaSoft site and how to install it on the various supported platforms. We will be assuming that you already have some familiarity with the internet and the world wide Web, and know the basics of using a Web browser.
The first thing you will need to download the JDK is a computer with a connection to the Internet that can use a Web browser. The particular Web browser doesn't really matter all that much, but for our examples we will be using the Netscape Navigator browser.
The second thing you will need is some (well, actually, quite a bit) of free hard disk space on the machine you are planning on downloading the JDK to. Just to download the JDK to a Solaris machine, you will need about 5.4 megabytes worth of free disk space. To uncompress and unpack it, you will need another 10 meg of space. On a Windows 95/NT machine, you will need 4.4 meg for the JDK and about 6.5 meg to uncompress it. On a Macintosh, you will need 2.5 meg of free disk space, and another 6 meg to install it.
If you have some free disk space and a browser handy, you're ready to download. Let's get started!
http://www.javasoft.com/JDK-1.0/installation.html
You will be presented with a list of the currently supported platforms. The platforms currently supported by Sun are -
Here is a list of the URLs for the various JDK releases. These are taken directly from the JavaSoft site. These are provided in case the JavaSoft site is unavailable, or if you want to use normal FTP to get the files.
If you have a platform that is not listed above, there may or may not be a port for your particular machine, and it will not be supported by Sun. For information on obtaining or helping develop third party ports of the Java Developers Kit for your particular platform, try the Java External Related Mailing Lists and Resources page at
This page has lists for resouces and ports outside of Sun, such as the DEC Alpha, Amiga and Linux ports.
4. Wait while it downloads. The JDK is a pretty big file, and downloading is going to take a while. How long it takes depends on how fast your connection is, the user load on the ftp server at that particular moment, the network load on the internet at the time of day you are downloading the file, the beating of a butterfly's wings somewhere on the planet, sunspots, blind luck, and a large number of other factors that are even more difficult to predict. If the file transfer is going too slow for your taste, try connecting at another time. Depending on where you are on the planet, good times to connect will vary, again depending on many of the same factors as control the transfer rate.
Hopefully, you've now got the JDK for your machine on your hard disk. Now you are ready to install it, so take a deep breath, get up, walk around the room, sit back down, and dive into the next section, Installing Java.
Now that you know a little about Java, and you know where to get it, you'll probably want to install it on your computer so you can start using it.
This section focuses on Java installation, including instructions for:
These instructions are for the JDK only. If you have a Java package from a third-party provider, please refer to the instructions provided with your package.
The JDK is normally distributed as a compressed tape archive (a file with a .tar.Z extension); the name of the file indicates its version.
It is probably well worth your while to archive your current installation, either through the use of tar or your standard system backup process, prior to beginning installation of a new version.
Do not install the JDK over a previous release! Especially if the previous release is one of the pre-beta or beta 1 versions.
Rename the java directory with a command similar to:
mv java java.old
If the installation fails for any reason, you can restore the previous version directly from java.old. Otherwise, after the installation is complete, you can move any additional files, such as documentation, from your old installation into your new installation before removing it from your system.
ls -ld /usr1
drwxr-xr-x root other 512 Feb 18 21:34 /usr
zcat JDK-1.0-solaris.tar.Z | tar xvfB -
setenv PATH $PATH:/usr1/java/bin
PATH= $PATH;/usr1/java/bin export PATH
setenv CLASSPATH /usr1/java/lib/classes.zip
CLASSPATH= CLASSPATH /usr1/java/lib/classes.zip export CLASSPATH
Rather than set these variables from the command line each time, you probably should add the commands to set the PATH and CLASSPATH variables in your shell resource file-.shrc, .cshrc, .profile, and so on. If you are a system administrator installing the JDK as a network development tool, you may want to add these parameters to the default configuration files.
These instructions are for the JDK only. If you have a Java package from a third-party provider, please refer to the instructions provided with your package.
You need Windows 95 or Windows NT to run Java; it will not run under Windows versions 3.0, 3.1, or 3.11-including Windows for Workgroups.
Why can't they make Java work under Windows 3.x? At the time of this writing, no one has had the time, much less the patience, to produce a production-quality version of Java for earlier versions of Windows. There are several reasons for this, but the biggest ones seem to be these: difficulty in creating a multi-threaded environment under an operating environment that does not support pre-emptive multitasking TCP/IP support the 8.3 file format requires a rewrite of the Java interpreter, which expects certain file extensions
The JDK is normally distributed as a self-extracting compressed file; the name of the file indicates its version.
It is probably well worth your while to archive your current installation, either through the use of PKZIP or your standard system backup program, prior to beginning installation of a new version.
Do not install the JDK over a previous release! Especially if the previous release is one of the pre-beta or beta 1 versions.
Rename the java directory (for example, to oldjava) using the Explorer in Windows 95 or File Manager on Windows NT. If the installation fails for any reason, you can restore the previous version directly from oldjava. Otherwise, after the installation is complete, you can move any additional files, such as documentation, from your old installation into your new installation before removing it from your system.
set PATH=c:\windows;c:\dos;...;c:\java\bin
set CLASSPATH=c:\java\lib\classes.zip
If you want to squeeze a little more performance out of Java (at the cost of a little more disk space), move the classes.zip file to c:\java\classes (you need to create this directory), and use PKUNZIP to extract the files. You can then remove the classes.zip file.
If you choose this option, you will need to change your CLASSPATH environment variable to c:\java\classes.
These instructions are for installing the JDK only. If you have a package from a third-party developer, please refer to the instructions provided with your package.
The JDK is normally distributed as a stuffed, bin-hexed archive (a file with a .hqx.sit extension). The file version is indicated in its name. This version runs on '040 generation Macs as well as PowerPCs.
Currently, there is only one version of the JDK available for the Mac (1.0b1). This version runs on both '040 and PPC class machines. As newer versions are released, you will want to install them; make sure to archive your current version before installing a newer version.
The Macintosh allows users to name directories and files in a manner that chokes UNIX. This includes the naming of folders with slashes (/). This causes problems with the JDK because when the JDK attempts to locate your files, it uses a mixed UNIX/Mac method of tracking paths. Thus, a slash in the name of a folder is interpreted as a change of directory.
UNIX also has a few problems with names that include spaces. As of this release, you should follow the UNIX file and directory naming conventions used by the developers. That means you shouldn't use spaces, slashes, asterisks, and most other punctuation characters in your file and directory names. You can, however, use as many periods as you want, and the filename can be as long as you want it (as long as it's less than 32 characters long).
For technical support for our books and software contact support@mcp.com
Copyright ©1996, Que Corporation