Launching Your Programs

In this section, you will learn more about launching the Java executables in the workbench.

1.

In the Packages view, find junit.textui.TestRunner.java and double-click it to open it in an editor.

2.

In the Outline view, notice that the TestRunner class has a "runnable" icon.

3.

In the Packages view, select the junit.textui package and click the Run button in the toolbar.

4.

In the Run dialog, make sure that the Set as default launcher for project JUnit box is checked, then click Next.

Note: This option "remembers" that the Java Application Launcher should be used for running programs in this project.

5.

In the Select Target dialog, select TestRunner- junit.textui, and click Finish.

6.

The Debug perspective opens, and the TestRunner program runs with a message in the Console view telling you that the program needs an execution argument.

Notice that in the Processes view, the JUnit launch is represented.

Note: You can choose whether to automatically switch to the Debug perspective when launching a program on the Debug preferences page (Window > Preferences > Debug).

7.

Return to the Java perspective by clicking the corresponding perspective button in the shortcut bar, along the left edge of the main workbench window.

8.

In the Packages view, select the junit.textui.TestRunner.java resource and from its context menu, select Properties.

9.

In the Program Arguments field on the Execution Arguments properties page, type junit.samples.VectorTest. Then click OK.

10.

Select TestRunner from the drop-down menu from the Run button in the workbench toolbar. This list contains the previously-launched programs.

11.

The Debug perspective opens, and the TestRunner program runs correctly this time, indicating the number of tests that were run.

Notice that in the Processes view, a different JUnit launch is represented.

Note: You can relaunch any of these processes by selecting Relaunch from its context menu.

12.

From the context menu in the Processes view, select Remove All Terminated to clear the view of terminated launches.