JDK/TextPad for Windows
(last updated: Jul 20, 2005)

Select font size:
This document describes the installation of the file editor TextPad and the Java Standard Development Kit, JDK1.5.0_04 for a Windows platform on your home computer.

Install JDK before TextPad if possible; in this way it will add standard Java compile and execute commands to the Tools menu. If you don't do the installation in this order you can add the java tools into TextPad by hand later.

Install JDK

You can obtain the most recent version of JDK from Sun's site
Follow the J2SE 5.0 link. For Windows, you can choose the installation or offline installation. The former downloads a stub to your computer which does the most significant downloads during installation. The offline installation downloads the entire thing. This is a self-installing Windows executable. You can also download this file through this link on my site:
Before installing a latest version, you have to decide whether to remove or keep older versions of Java Development Kit and Java Runtime Environment that you may have on the computer. I tend to favor removing them, but if you're unsure, just keep the older versions. The latest Java version installs in the directory:
\Program Files\Java\jdk1.5.0_04
Observe that the freely-distributable JRE (Java Runtime Environment) is also installed in the adjacent directory:
\Program Files\Java\jre1.5.0_04

Install TextPad

TextPad (http://www.textpad.com/) is a shareware editor program. The unregistered version differs from the registered version (which costs ~ $27) only in periodically showing a "nag message". The textpad version 4.73 can be downloaded from my site at:
Download it through it's own site, through this link: txpeng473.exe or from the course site. It also is a standard self-installing Windows executable.

Change the Folder View in Windows to show file extensions:

Tell Windows to stop treating you like a baby, make it show you file extensions.

Set up .java file associations

It facilitates program development to have TextPad automatically start up when you double-click a Java source file (recognized by the suffix). Start up TextPad, follow the menus through Configure -> Preferences -> Associated Files and add the extension .java to the list.

To enable TextPad for Java compilation support, follow the menus through Configure -> Preferences -> Tools. From the Add button, select JDK Commands. This will add three tools: Compile Java, Run Java Application and Run Java Applet.

Compiling and Running Java Applications from TextPad

After you create one or more Java source files in TextPad, they will be listed in the Document Selector window. To compile it, select the source file and then Tools -> Compile Java. The results of the compilation are displayed in a new Command Results window. This will show any errors generated by the compilation. For most Java applications, you only need to compile the class file with main to compile all the class files.

To run the Java application, simply make sure the file containing main is selected and choose Tools -> Run Java Application. This will bring up a DOS shell which will automatically run the file's class through the Java virtual machine.

The PATH and CLASSPATH environment variables

If you want to be able to run some of the Java applications you create by using a shell, you will probably need to set the PATH and CLASSPATH environment variables. For Windows ≥ 2k, the environment variables can be manipulated by an administrator through this (and other) access method:
Control Panel -> System -> Advanced -> Environment Variables


The PATH environment variable is the semicolon-separated list of directories which contain executables available to various applications, in particular to the command shell. You want the PATH variable to contain this directory (assuming C: is the drive of the system root).
\Program Files\Java\jdk1.5.0_04\bin
When you edit the PATH variable, this directory component could be placed anywhere. It might be easiest to scroll to the far left append to the front this syntax:
\Program Files\Java\jdk1.5.0_04\bin;


The CLASSPATH variable is a similar list of directories, jar-files, etc. which extend the classes available to Java. Initially you probably want the CLASSPATH environment variable to be unset, or deleted. A software package that you have installed may have automatically set this variable for its own needs, leaving it unusable for general-purpose usage. You may want to save CLASSPATH's current value so that you can restore it if something else goes wrong later.

It actually may not be necessary for you to change the CLASSPATH environment setting; it may be OK the way it is. Alternatively, when you start up a shell to execute a Java application, you can unset CLASSPATH for that particular shell instance by typing:

Make sure there is actually NOTHING after the =. This has the effect of unsetting the variable.

Seeing the environment values in a shell

If you're unsuccessful in either compilation or execution of a Java application from a shell, you should double-check the values of these two important environment variables by typing:
set PATH
Without the "=" after the set syntax, these commands simply show the current values.

Setting up a DOS shell in TextPad

Assuming that you are using Windows ≥ 2k and that the CLASSPATH and PATH are set through the environment variables as suggested above, you can simply add the shell command executable, cmd.exe to the Tools menu:
  1. Choose: Configure -> Preferences -> Tools -> Add -> Program
  2. Navigate to choose in the Select A File menu the file C:\windows\system32\cmd.exe (for Windows 2000, C:\winnt\system32\cmd.exe).
  3. Click Apply. The command name will be cmd
  4. Go to the left-hand side of the menu and expand the "Tools" listing.
  5. Click on the new cmd command just created to bring up a properties display on the right-hand side.
  6. Uncheck the "Capture Output" box.

Test the Installation

Open TextPad, create the following file and save it as Hello.java.
class Hello {
  public static void main( String args[] ) {
    System.out.println( "hello world" );
From the Tools menu do Compile Java then Run Java Application. You should see a DOS shell created which prints out the infamous hello world message.

Alternatively, if you set up a shell as above, test it by bringing up the shell, compiling and executing from the command line by typing in succession:

javac Hello.java
java  Hello