Java Reference
In-Depth Information
You can either enter the fully qualified name of the class into the
Main class
field yourself or click the browse icon next to the field to have
IDEA
help you. The
browser brings up a list of all the classes in your project that have an appropri-
ately defined
main()
method, as shown in figure 5.18. Select the class you wish to
run, and click
OK
(or press
Enter
) to have
IDEA
fill in the field with the name of
the selected class. You can also begin typing the name of the class, and
IDEA
will
reduce the list by showing only the classes that have names starting with the let-
ters typed. Note that all
IDEA
wants in this field is the class nameāit doesn't need
the
main()
method tacked onto the end. Alternatively, select the
Project
tab and
navigate the project tree to find the appropriate class, as shown in figure 5.19.
Specifying VM parameters
The next field
in the
Run/Debug Configurations
window,
VM
parameters
, is
optional. You only need to put something in this field if you require parameters
to be passed in to the
VM
in order for your application to run correctly. Typical
options define system properties, increase the heap size, and specify garbage-col-
lection options for tuning
VM
performance. The contents of this field are passed
to the
VM
when
IDEA
launches the application. In the example in figure 5.17, we
aren't passing any
VM
properties in this configuration; however, we could easily
pass one to increase the size of the heap.
IDEA
may also pass in other options
based on your
IDE
settings. For example, if you've specified a particular file
encoding,
IDEA
passes this to the
VM
through the appropriate system property.
Figure 5.18 You can choose a class with a
main()
method by
searching the entire project tree by name. The applicable classes are
listed here alphabetically, with their package shown for reference.
Expressions in the top text field filter the list to include only classes
whose names match the expression.