Installing Java on Your Home Computer

The Java compiler that we will start out using is available for free to anyone who wants to install it on their computer. It is provided by Sun Computer, the company that invented the Java programming language. This compiler is not as convenient to use as commercial compilers, but it is good enough for starting out with. The instructions below try to explain how to install this compiler on your home computer, assuming that you have Windows 95. This is not all that easy; there are several steps, you need to download several pieces of software, and all the pieces have to be put in the right place. Keep your browser running and open to this page as you go through the instructions (or print these instructions out before you begin).

There are two versions of Java available from Sun, JDK 1.0 and JDK 1.1. The JDK 1.0 is an older version of Java, and the JDK 1.1 is a newer version. Our textbook is written for the new version and many of the sample programs in the book will not work with the older version. This page gives instructions for installing the newer version, JDK 1.1. If you have trouble downloading this newer version and would rather install the older (easier to install) version of Java, follow the instructions on this other page, but that older version of Java will only be good up until we get to Chapter 6 of the textbook.

Step 1:
If you do not have the program WinZip already installed on your home computer, then you should install it first. Download the Windows 95 version from the WinZip Download Page; follow the instructions on that page to install WinZip.

Step 2:
Download the Java compiler package from Sun. The complete name for this compiler package is the "Java Development Kit 1.1.8 for Windows"; everything you need is in one file that is about 9MB in size. You start the process of downloading this package by clicking on the link just below. That link takes you to a page at Sun's web site that has instructions for downloading the JDK. On that page click on the button (under Step 1) labelled "continue". You are then taken to a "License Agreement" page; click on the button labelled "Agree". You are then taken to the actual download page; click on the button labelled "FTP download" and have your browser save the distribution file to your C:\ directory. (On this same page Sun also provides installation instructions, but I suggest that you follow the instructions on this page instead.) You can start this whole process now by clicking on the following URL:
Java Development Kit 1.1.8 for Windows

Step 3:
Now that you have the distribution file jdk118-win32.exe in your C:\ directory, find it in a directory window and double click on it. It will automatically run an installer program. You will need to click on several buttons to move the install process along. Always accept the default choices (if you don't, other steps will need to be changed latter on). The installer will create a directory C:\jdk1.1.8 into which it will place all the Java files (about 15 MB worth). After the installer is done, you can delete the distribution file jdk118-win32.exe to save space if you wish.

Step 4:
Now you need to download a DOS batch file, javaset.bat. Place this file in your C:\ directory (not in the C:\jdk1.1.8 directory). When you click on the above link, if your browser asks where to save the file, save it in C:\. If your browser displays the batch file, then click on the browser's "File" Menu, click on the "Save As" command, and save the batch file in C:\.

Step 5:
You need to create a directory C:\cs125 on the C: drive. To create C:\cs125, open C:\ in a directory window, click on the "File" Menu of this directory window, and choose "New" -> "Folder". Call the new folder cs125.

Step 6:
Download this very short Java program into the C:\cs125 directory that you created in the last step. Either right click on the previous link and tell your browser where to save the file, or click on the previous link, which will display the file in the browser window, and then use the browser's "File" -> "Save as ..." menu item to save the file.

Step 7:
Now you are ready to try out Java. But first make sure that you have read Chapter 2, pages 10-20, of the "Java for Students" textbook. To compile the short Java program that you just downloaded in the last step, use the Start Menu to start up a "MS-DOS Prompt" window. At the DOS prompt, type the DOS command
cd C:\cs125
which will move you to the directory C:\cs125. Now enter the command C:\javaset (which should respond with a line of output beginning with the word PATH). Now enter the command javac (you should get a "usage" message back from the java compiler). Now enter
javac Hello.java
(you should NOT get any output back). Now type
java Hello
(you should get the output Hello, World!).

Step 8:
If the last step was successful, then you are ready to try out your own Java program. To familiarize yourself with the Java compilation process, follow the directions on pages 14-17 of the "Java for Students" textbook. For an editor you can use either Notepad (use the "Start Menu" -> "Run" menu item and enter the command "notepad"), or you can use the PFE or TextPad editors (see Step 10 below). After you create a Java program file with an editor, save the file in your C:\cs125 directory. It is a good idea to create a subdirectory of C:\cs125 for each chapter of the book (or create a subdirectory for each Java homework assignment).

Step 9:
When you are done working with Java, it is a good idea to make a copy of your work on a floppy disk. In particular, if you want to work on Java back in the computer lab again, then you need the floppy in order to move your Java files to your "Home directory" on the lab computers. You need a high density floppy disk (there should be enough room on it to hold all your Java programs). Copy the directory C:\cs125 onto the floppy. The easiest way to do this is to put the floppy in the A: drive, open a directory window for C:\ and another window for "My Computer", and then just drag the folder C:\cs125 onto the icon for the A: drive. This creates a directory A:\cs125 on the floppy disk and copies everything from C:\cs125 into A:\cs125.

If you do all of your Java work on your home computer, then the next time you want to work on Java you just need to open the C:\cs125 directory and begin working. If you do some of your Java programming on campus, then when you return to the computer lab you will need to update your H:\cs125 directory using your floppy, which should have on it the latest versions of your java programs.

Step 10:
These last two steps are optional. If you would like to, you can download a good text editor to use instead of Notepad for editing your Java source files. You have your choice of two editors, one shareware and one freeware.

A good freeware text editor is the Programmer's File Editor (PFE). Since PFE is freeware, you can use it for as long as you wish, without having to pay. Use the following link to download the distribution zip file.

The Latest Version of PFE
Download the 32 Bit Edition of PFE. You can either download the distribution zip file onto your desktop, or download it onto the C:\ drive. Once you have the distribution zip file, create a directory C:\pfe and extract the zip file into it. You need to create your own program group for the start menu, or better yet, put a shortcut to PFE on your desktop and/or in the folder "C:\Windows\Send To".

A very good shareware text editor is TextPad. Since TextPad is shareware, you can download and use it for free for a trial period, but then you are supposed to pay a modest shareware fee if you plan to continue using it. Use the following link to download an installation file.

ftp://ftp.textpad.com/pub/tpe32325.exe
Download this installation file onto your desktop. Double click on the installation file to start the installation process. Delete the installation file after TextPad has been installed.

Step 11:
To make it easier to work with the Java language, you can use either the PFE or the TextPad editor as a "developement environment", somewhat like what our textbook describes on page 11. To do this, you need to download three files. Two of these files work with either PFE or TextPad, and the third file is specific to which editor you want to use.

Download the following two DOS batch files into your C:\ drive (not into C:\cs125).

If you are using TextPad as your editor, then download this registry file into your C:\ drive. If you are using PFE as your editor, then download this other registry file into your C:\ drive (this is not the same registry file that you would use in the computer labs on campus). When you have one of the registry files in your C:\ drive, double click on it. This will modify the editor so that you have commands built into the editor for compliling a Java program, viewing a Java applet, or running a Java application. We will demonstrate in class how you can use these built in commands. (You should delete the registry file after you have double cliked on it.)

NOTE:
When you are editing your Java source files with any editor, remember to save your work frequently (at least every 15 minutes), otherwise it may be Abort, Retry, Ignore?


Return to the main Java page.
Return to the CS 125 home page.


compliments and criticisms