The NetRexx Pinger application

This is an example of a stand-alone Java application, which has been written in NetRexx; when running, it should look something like this:
Pinger is a 'kitchen timer' application. Use the unmarked spin buttons to set the minutes and seconds, then press Start to start the timer.

The program shows the use of Frames, simple menus and Dialogs, multiple threads (for the spin buttons and the main timer function), a custom component, off-screen Image drawing (graphics), Java 1.1 mouse and event handling, and playing an audio clip from a file.


  1. To hear the pinger 'ring', you need a sound card or equivalent installed and working. This plays the clip in the file '' – this can be any sound clip in .au format, 0.5 seconds or less; a default is supplied below.
  2. The first time you press Start, you may notice a pause or hear a short click or ring, as the Java audio system is started. This is normal, and ensures that the audio will be played promptly when the timer reaches zero.
  3. Some platforms may limit the maximum font size available for displaying the timer.
  4. This application requires Java 1.1.

Here's the NetRexx source, as a plain ASCII file. Here, too is the pinger sound clip.

You can also download the Pinger package (with the .class files already compiled from the source) in zip format [, 23kB]. The Pinger package is also included in the NetRexx package – you may prefer to download the whole package, including the other NetRexx samples and examples.

Please note that the Pinger package is part of the NetRexx package, and is covered by the terms in the IBM License Agreement for that package.

Running the Pinger

Note that the Java runtime (e.g., from the Java Development Kit) must be installed before you can run stand-alone Java applications, and you must also have either the NetRexx runtime or compiler installed, too. See downloading the NetRexx package for more details.

Running the Pinger from the .class files

If you downloaded the package above (, first unpack the files into a directory (see User's Guide for details of the commands to use for unpacking). Then, in that directory, run:

  java Pinger

Note that you need the capital letter 'P' as shown, as the java command is case-sensitive.

Compiling and running the Pinger

To compile and run the program, create or copy the 'Pinger.nrx' file (note the first letter is a capital letter), and then enter the commands:

  java Pinger

  java Pinger

This would:

  1. Call the NetRexx translator to translate the program from NetRexx to Java
  2. Call the Java compiler (javac) to compile the program into the class files for the pinger
  3. Call the Java interpreter (java) to interpret the class file, which should then display the pinger.

[ IBM | Help | Legal | Privacy ]