Running Java Programs with TextPad


This handout explains how to set up Java and TextPad on your own computer so you can write and run Java programs at home.

Download Java

Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to download the Java SE Development Kit. Choose the version to match your OS. Click on the Download button and follow the prompts to download and install the Java software.

Download TextPad

Go to http://www.textpad.com/download/index.html. Follow the instructions to download and install TextPad. TextPad is shareware, which means that the developers request that you pay for it (the fee is about $30) but the software will continue to work even if you don't pay. Make sure you download and install the Java software before you download and install TextPad.

There are a couple of TextPad preferences that you can change to make your program handle tabs better. From the Configure menu, choose Preferences. Open Document Classes if necessary, by clicking on the + sign, and open Java the same way. Click on Tabulation and make sure you have the following settings:

   Default tab spacing              4
   Indent size                      4
   Convert new tabs to spaces       check
   Convert existing tabs to spaces  check

Compiling and Executing Java Programs

Remember you must save each class in a file with the same name as the class. Be careful about caps, class names are class sensitive and the Java compiler is also.

To compile, on the Tools menu choose External Tools and then Compile Java. A message pane will open at the bottom of your TextPad window. If you have any syntax errors, your error messages will appear here. You can double click on a message to go to the line with the error. The keyboard shortcut <ctrl>1 will also compile your program.

To run your program, on the Tools menu choose External Tools and then Run Java Application. The keyboard shortcut <ctrl>2 will also run your program.



Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2017