In this section, you will learn more about running Java programs in the workbench.
1. |
In the Package Explorer 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
an icon which indicates that this class defines a ![]() |
3. |
Using the drop-down Run button in the toolbar, select Java Application from the cascading Run As menu. This will launch the class in the active editor, or the selected class in the Navigator, as a local Java application. ![]() |
4. |
Notice that the program has run and the following message appears in the Console view telling you that the program needs an execution argument. ![]() |
5. |
Using the drop-down Run menu in the toolbar, select Run.... ![]() |
6. |
The Launch Configurations dialog opens, and the TestRunner launch configuration is selected. When you ran the program using the Java Application shortcut, a launch configuration was automatically created with default settings to launch the selected class. ![]() |
7. |
Select the Arguments tab and type junit.samples.VectorTest in the Program arguments area. ![]() |
8. |
Click Run. This time the program runs correctly, indicating the number of tests that were run. ![]() |
9. |
Switch to the Debug perspective. In the Debug view, notice that a launch was registered each time the program was run. ![]() Note: You can relaunch any of these processes by selecting Relaunch from its context menu. |
10. |
Select the drop-down menu from the Run button in the workbench toolbar. This list contains the previously launched configurations. Configurations can be relaunched by selecting them in this history list as well. ![]() |
11. |
From the context menu in the Debug view (or the equivalent toolbar button), select Remove All Terminated to clear the view of terminated launches. ![]() |