Home

 

Creating a run configuration

In some cases, you might want to override the derived parameters or specify additional arguments. To create a run configuration, do these steps:

Select Run Æ Run Configurations, or click the arrow of in the toolbar and select Run Configurations.

In the Run dialog, select and then click to create a new configuration (Figure | -28). Notice that we already have a configuration from running the BankClient application.

Figure 8-28 Run configuration dialog

The Main tab defines the class to be launched:

Project: Select the project containing the class to launch.
Main class: Click Search to get a list of all executable main classes in the project. Select the main class to be launched.
With the check boxes Include system libraries when searching for a main class and Include inherited mains when searching for main class, you can expand the area where Application Developer is searching for an executable class.
Stop in main: The program stops in the main method whenever it is launched in debug mode.You do not have to specify a project, but doing so allows a default classpath, source lookup path, and JRE to be chosen.

The Arguments tab defines the arguments to be passed to the application and to the virtual machine. To add a program argument, do these steps:

You can type a value directly into the field, or you can use a variable:
Click Variables below the Program arguments field.
Select one of the predefined variables or create your own variable by clicking Edit Variables and then New.
Enter the name and the value for the variable and click OK to add it.
Click OK again to return to the Select a variable dialog. The new variable is now available in the list. Select it and click OK to return to the Arguments tab.
In the same way, you can also add VM arguments.
You can also specify the working directory to be used by the launched application.

The JRE tab defines the JRE used to run or debug the application. You can select a JRE from the already defined JREs, or define a new JRE.

The Classpath tab defines the location of class files used when running or debugging an application. By default, the user and bootstrap class locations are derived from the associated project's build path. You can override these settings here.

The Source tab defines the location of source files used to display source when debugging a Java application. By default, these settings are derived from the associated project's build path. You can override these settings here.

The Environment tab defines the environment variable values to use when running or debugging a Java application. By default, the environment is inherited from the Eclipse runtime. You can override or append to the inherited environment.

The Common tab defines general information about the launch configuration. You can select to store the launch configuration in a specific file and specify which perspectives become active when the launch configuration is launched.

Click Run to launch the class.
ibm.com/redbooks