Installing Java on your home computer

To write Java programs you need some kind of Java development environment. The simplest one that you can get is Sun's JDK (Java Development Kit). The Sun JDK is a free collection of command line tools for developing Java programs. But the JDK is not too easy to use, since it is command line based, and it does not really contain all of the tools that you will need (for example, it lacks an editor and a debugger). Several companies have produced Integrated Development Environments (IDE's) that have all of the tools you might need to write Java programs. But these IDE's tend to be very large, very resource intensive programs that actually contain far more programming tools than are needed for writing small to medium size programs. As an alternative to using a large IDE, this page explains how to install what I think is the simplest and most elegant IDE for writing small to medium size Java programs. Basically, what we will do is install the Sun JDK and then install a very good text editor as a "shell" or "wrapper" for using the JDK. Below are the steps to follow to install this combination of programs on MS Windows.

We will be using release 1.4.1 of the Java 2 Standard Edition (J2SE) development kit. This page tells you how to install this programming environment on your home computer. There are roughly two parts to this installation. The first part is installing the Java development kit (JDK) on the computer and the second part is installing a text editor that makes it easier to use the JDK. The first part of the installation is absolutely essential if you want to do Java programming at home. The second part is not essential, it is just to make your life easier while you write Java programs. Steps 1-3 below are the part that installs the Java JDK on your computer and steps 4-7 install the editor and test the Java installation.

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 version from the WinZip Download Page; follow the instructions on that page to install WinZip.

Step 2:
Install Sun's JDK 1.4.1. Use the link at the end of this paragraph to go to Sun's download page. You want to download the "Windows (all languages, including English) SDK" that is second from the top of the list of downloads. That will take you to a page where you can download an installation program. The JDK 1.4.1 installer is 36 MB, so expect the download to take several hours using a modem. To install the JDK, follow the installation instructions from Sun's web pages. (It is probably a good idea to print out these instructions before installing the JDK.)
Sun's JDK 1.4.1 download page

Step 2.5 (Optional):
The JDK does not come with any documentation. If you want the HTML version of the documentation, then you need to install that separately. But the HTML version of the documentation is large (about 180MB installed) and not easy to use. Later in this page I will show you a better version of the documentation to install. But if you want the HTML version, read on.

The HTML version of the documentation comes in a zip file (that's why you need WinZip) called j2sdk-1_4_1-doc.zip. Download this file from the link at the end of this paragraph. Unzip the zip file into a temporary directory. The temporary directory will contain a sub-directory called docs. Move the docs directory to be a sub-directoy of the directory C:\j2sdk1.4.1_10 which was created by the installer in the previous step (the last two digits in this directory name are the "version number" of the JDK, and this number might increase over time).

Sun's JDK 1.4.1 HTML documentation download

Sun's JDK 1.4.1 Documentation Installation Instructions

Step 3:
If you want to, you can test your JDK installation. Use the Start Menu to start up a "Command Prompt" window. At the command prompt, enter the following command.
c:\j2sdk1.4.1_01\bin\javac
You should get a "usage message" back from the Java compiler. Now download this Hello.java file. At the command prompt, use the cd command to move to the directory where you stored the file Hello.java. Compile Hello.java with the following command.
c:\j2sdk1.4.1_01\bin\javac Hello.java
After the program compiles, run the program with the next command.
c:\j2sdk1.4.1_01\bin\java Hello

Step 3.5 (Optional):
In the last step we used the "full path name", c:\j2sdk1.4.1_01\bin\javac, at the command prompt for the Java compiler javac (and similarly for the Java virtual machine, java). If you want to work with Java from the command prompt, using full path names can be inconvenient. So you may want to set the Windows PATH variable to include the Java JDK. How to do this is explained in Step 5 of Sun's installation instructions. If you do not want to use the command prompt, then this step is not needed (and setting the PATH variable is not needed for any of the following steps).

Step 4:
If you have already installed TextPad on your computer (for use with another programming language), then skip to Step 6. Otherwise, download the TextPad Version 4.6 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 1.8 MB in size).
ftp://download.textpad.com/pub/textpad4.6/txpeng460.exe

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

Step 6:
Run TextPad by finding it in your Start Menu. Click on the Tools menu at the top of the TextPad window. If you just installed TextPad, then should see three commands for using Java at the bottom of the list of tools. If you do not see the commands, or if you installed TextPad before you installed the Java JDK, then go to TextPad's Configure menu and click on the "Configure -> Preferences..." menu item, then click on "Tools" (not the little + sign next to "Tools"), then click on "Add" and then select "JDK Commands" from the drop down menu, finally click on "OK". (For more information on using the JDK with TextPad, and on TextPad's tools, click on the "Help -> Help Topics" menu item and use the "Index" tab to search for JDK).

Step 7:
Now it is time to test TextPad. Use TextPad to open your file Hello.java from Step 3. 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. Compile the program to see what happens. Double click on the line number in the compiler's error message to have TextPad jump to the offending line. Try using the keyboard shortcuts to compile and run your program.

Step 8 (Optional):
When learning Java, it is important to learn how to use Java's documentation. So now we will install an easy to use WinHelp version of the Java documentation. Open your C:\j2sdk1.4.1_01\ directory and create a subdirectory called docs-win. Download the WinHelp version of the JDK 1.4.1 documentation using the link at the end of this paragraph. (That link takes you to a page in France where the person who maintains these help files resides.) Download the file jdk141-wh.zip. After you have downloaded the zip file, use WinZip to unzip it into a temporary directory. Then move the contents of the temporary directory to the C:\j2sdk1.4.1_01\docs-win\ directory that you just created.
Franck Allimant - WinHelp JDK 1.4.1 Documentation

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 the "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:\j2sdk1.4.1_01\docs-win\ directory, select the file Jdk14.hlp, click the "Open" button, click the "OK" button. Now look at the bottom of your list of TextPad tools in the "Tools" menu. There should be a tool called Jdk14. Once again open your Java program Hello.java with TextPad. Use your mouse to highlight the word String, and then click on the "Tools -> Jdk14" tool menu item. This should bring up a help window about the String class. Go back to the Java source code and try highlighting the name of a method from the JDK and then click on the "Tools -> Jdk14" tool menu item. This should bring up a help window about the class that the method is defined in with the method that you choose at the top of the visible 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 really pale in comparison to an editor like TextPad.

When you are editing files, 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