It's time to use a little shortcut. Back in Step 8.1 you used the Run... option from the Run tool's dropdown. In subsequent steps, you selected all the defaults, and that was sufficient to run the program. Well, there's a quicker way to do all that. Use the Run As submenu and select the Java Application option. This will run the selected program as a Java Application with all the defaults. Let's do that now and watch how it works.
q 8.3(a) Left-click on HelloWorld2.java to select it.
q 8.3(b) From the Run tool dropdown, select Run As/Java Application.
Note | Now that you've run the HelloWorld program and created the HeIloWorld launch configuration, that configuration shows in the Run tool's dropdown list for easy access. As you add more configurations, they will be added as well, each with a number. The one marked number "1" will be the one selected if you just hit the Run tool button itself. |
So you see the output as shown below. However, since there's very little real estate given over to the Console view, you might want to expand it. As always, to expand a view you just double-click on the title bar.
q 8.3(c) Double-click on the Console view title bar.
You'll see a view like the one in Figure 8.24. Notice that there are three "Hello" lines: Hello 0, Hello 1 and Hello 2, because you set the initial count to 3.
Double-click on the title bar again to restore the display to its original view.
q 8.3(d) Double-click on the title bar again.
We're back to the original view, as shown in Figure 8.25. Okay, you've accomplished both editing and running. Now it's time for the last step in development ” debugging.