Java Reference
In-Depth Information
the profile. The second option, Make project before running/debugging/reload-
ing , triggers an automatic build of the project before executing. Enabling this
option makes sure any source files that have changed are recompiled appropri-
ately. If there have been no changes, your program will run. If you've enabled any
Ant targets to run as part of your build, they will be executed as well.
Both the Display settings before running/debugging and Make project
before running/debugging/reloading options are global settings for
the project. There is no way to enable these options differently for
each configuration.
WARNING
Creating multiple configurations for the same class
You aren't limited to creating one configuration profile for each Java class that
you want to execute. You're free to create as many different configuration profiles
as you need, specifying different working directories, program parameters, or VM
settings. Doing so lets you create several combinations of settings to run your
application with different arguments. For example, if you use an executable to ini-
tialize your database that takes the database URL from a command-line argu-
ment, you can set up separate targets for initializing your development and
testing databases. The only restriction is that the names for the configurations
must be different, because the name is the only identifier for a given profile.
5.3.2
Executing a Run configuration
Once configured, you can run your application by first selecting the appropriate
configuration profile. Because the configuration contains all the details of the
running state—including the class to run, its arguments, its working directory,
and the like—the configuration needs no additional data to execute. It has essen-
tially become accessible via a single mouse-click or keystroke.
Selecting a configuration profile
On the IDEA toolbar, select the configuration profile you want to run from the
drop-down list next to the Run icon, as shown in figure 5.20. Then, click the Run
icon to start or select the Run option from the Run menu, or press Shift+F10 . If
you've enabled the option to show the settings panel before running, your pro-
gram will run after you click OK to close the settings window. If you've enabled
the option to build the program before running, it will begin the build and, if suc-
cessful, launch the application. Otherwise, IDEA will directly launch your pro-
gram. The output generated by the program appears in the Run tool window,
which we'll discuss in the next section.
 
 
 
 
 
 
Search WWH ::




Custom Search