Running a Java Program in TextPad

Bring up TextPad and you will see:

 

Type in your program in the window at the right:

 

Save your program by clicking File (top left) and then Save As. In the pop up box, enter the name of the class (Hi in this example) in the File name box. TextPad will add a .java extension. In the Save as type box, choose Java. Click save. After saving your program, to compile it click on Tools and then select Compile Java:

 

As the program compiles, the window containing your program will temporarily go blank. If there are no errors, the message Tool Completed Successfully will appear and then your source code will reappear. (The Tool Completed Successfully window comes and goes so quickly, you may miss it.) To run your program, select Tools and then Run Java Application. Another window will pop up in which your program will run:

 

If there are errors, your program will be replaced by diagnostic messages:

 

In the top, left window you can click on your program so that it reappears. After fixing it and saving it (there’s a Save button on the second line, third from the left), try compiling again. To get compiler messages in the right window, click on Command Results in the top, left window; to get your source code in the right window, click on your source code file name in the top, left window.

In the top, left window you can click on your program so that it reappears. After fixing it and saving it (there’s a Save button on the second line, third from the left), try compiling again. To get compiler messages in the right window, click on Command Results in the top, left window; to get your source code in the right window, click on your source code file name in the top, left window.

To capture the output of a Java program in a window that you can then save (using "Save As"), print, etc., first click on "Configure" (7th item from the left on the toolbar). Next click on "Preferences". Next double click "Tools" (until a minus sign appears to the left of Tools). Next click "Run Java Application". Click in the box to the left of "Capture Output" so that a check mark appears. Click OK. You can repeat this process so that input/output occurs in a DOS window. In this case, you click in the box to the left of "Capture Output" so that a check mark does not appear.

After clicking "Run Java Application", if you click in the box to the left of "Prompt for parameters" so that a check mark appears, before the program is run, you will (not surprisingly) be prompted for parameters. In this way, you can enter command line arguments.