Installing Java on your home computer.

We will be using version 1.2 of the Java programming language for this course. This page will tell you how to install this programming language on your home computer. There are roughly two major steps in this installation. The first major step is installing the Java language itself on the computer and the second major step is installing a text editor that makes it easier to use the Java programming language. The first step is absolutely essential if you want to do you Java programming at home. The second step is not essential, it is really just to make your life easier while you are writing Java programs. Steps 1 and 2 below install Java on your computer and steps 3, 4, and 5 install the editor. Step 6 below is an important step. In that step you will try out your Java installations to see if it works.

Step 1:
Download Sun's JDK 1.2 installer program using the link at the end of this paragraph. Be sure to pay attention to where you tell your browser to store the installer. The JDK 1.2 installer is over 20 MB, so expect the download to take several hours using a modem. After the installer program is finished being downloaded, you install Java on your computer by just double clicking on the installer program that you just downloaded and following the instructions in the installer program. It is best if you do not make any changes in any of the options the installer program presents you with, always choose the default option.
Sun's Java Development Kit 1.2.x

Step 2
You need to modify the autoexec.bat file on C:\ drive. (If you do not have an autoexec.bat file on your C:\ drive, then you need to created one using the Notepad text editor.) Find the autoexec.bat file on your C:\ drive. Right click on this file using your mouse and choose the Edit option from the pop up menu. Move down to the end of the contents of autoexec.bat and add the following line to the file
set path=%path%;C:\jdk1.2.2\bin;
Be sure to enter this line into the file exactly as it is typed here (you can even use cut and paste to move the line from this web page to the autoexec.bat file). After you have added this line the file, choose Save from the File menu, then choose Exit from the File menu. Now you must restart your computer for this change in the autoexec.bat file to take effect.

Step 2.5 (Optional):
If you want to you can test your JDK installation. Use the Start Menu to start up a "MS-DOS Prompt" window. At the DOS prompt, enter the command javac; if you don't get a usage message back from the Java compiler, then you probably did not set your PATH variable properly in the last step.

Step 3:
Download the TextPad Version 4.1 text editor. TextPad is shareware; you can download and use it for free for a trial period, but then you are supposed to pay a shareware fee if you plan to continue using it. Use the following link to download the installation file (which is just over 2.3MB in size).
ftp://download.textpad.com/pub/textpad4.1/txpeng41.exe

Step 4:
Install TextPad by double clicking on the installer that you just downloaded.

Step 5:
Run TextPad by finding it in your Start Menu. Click on the Tools menu at the top of the TextPad window; you should see three commands for using Java at the bottom of the list, one command for compiling Java programs, one for running Java applications and one for running Java applets.

Step 6:
Now it is time to test TextPad and Java. It would help at this point if you would read Sections 1.7 to 1.10 of our Java textbook. Use your browser to download and save this very short Java program, Hello.java, to your computer (see Section 1.8, pages 21-25, of our Java textbook). Use TextPad to open Hello.java (use the "File -> Open" menu item in TextPad; you will need to remember where you had your browser store the Hello.java file). Use the "Tools -> Compile Java" menu item to have TextPad run the Java compiler. Now use the Tools -> Run Java Application menu item to have TextPad run your program. Now deliberately put a mistake into your Java program by deleting a semi colon (see the bottom of page 25 of the Java textbook and also Section 1.9). Compile the program again to see what happens. Double click on the line number in the compiler's error message to have TextPad jump to the offending line.

Step 7 (Optional):
If you do not have the program WinZip already installed on your home computer, then you should install it. Download the Windows 95/98/NT version from the WinZip Download Page; follow the instructions on that page to install WinZip. (This step is needed for the following two optional steps.)

Step 8 (Optional):
After you get past the really basic parts of learning Java, it helps to learn how to use Java's documentation. So now we will install an easy to use version of the Java documentation. Open your C:\jdk1.2.x\ directory (x is 1 or 2 depending on which version you installed) and create a subdirectory called docs-win. Download the Windows Help File version of the Java 2 documentation using the link at the end of this paragraph. (That link directs you to a page in France where the person who maintains these help files resides.) After you have downloaded the help file, use WinZip to unzip it into the C:\jdk1.2.x\docs-win\ directory that you just created.
Java Documentation in Microsoft Windows Help Format

Step 9 (Optional):
Now we need to create a tool in TextPad to use the help file we just installed. Start TextPad and go to TextPad's Configure menu and click on Configure -> Preferences... menu item, then click on "Tools" (not the little + sign next to "Tools"), then click on Add and then select "Online Help File..." from the drop down menu. Use the dialogue box to navigate to the C:\jdk1.2.x\docs-win\ directory, select the file Jdk122.hlp, click the "Open" button, click the "OK" button. Now look at the bottom of your list of TextPad tools, there should be one called Jdk122. Open a Java source file with TextPad, select the word class, and then click on the Jdk122 tool. This should bring up a help window.

TextPad is a very powerful text editor. It has a lot of tools that make working with Java and HTML files much easier. Editors like Notepad or DOS's Edit really pale in comparison to an editor like TextPad.

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 CIS 263 home page.


compliments and criticisms