Ping Launcher Example

To follow this example, import the Ping sample plug-in into your workspace.  Build and launch an Eclipse Application with this plug-in.

Pinging

This example uses the familiar ping command to test an IP address or domain name, writing output to the console. After launching your target Eclipse Application, use the following steps to ping an address.

  1. Open the Debug Configurations dialog (Run->Debug Configurations...)
  2. Create a new Ping launch configuration.
  3. In the Ping > Address field, enter an IP address or domain name.
  4. Press the Debug button to launch the ping command and see output in the Console view.

Editing a Ping launch configuration
Image of the launch configuration dialog editing a Ping configuration.

To see how the Ping launch is implemented, look at the following (in the Ping example plug-in):

The Ping example constructs a simple command line and spawns a system process (java.lang.Process). The system process is wrapped in an IProcess and is added to an ILaunch object. The launch object is displayed as a root element in the Debug view. A process provides access to its input and output streams which is displayed in a console. The debug platform automatically allocates a console for a process object registered with a launch. A process object monitors its underlying system process to know when it has terminated, and fires corresponding DebugEvent's to notify the debug platform of its state. A user can terminate a process by selecting it and pressing the terminate button.

Ping example running Ping example terminated
Image of Ping process and launch elements in Debug view running and terminated.