Because the IDE is built entirely on top of Ant, it uses an Ant script to run your applications.
This section covers the following topics:
For Java projects, you typically set the project that contains the program's main class as the main project. For web projects, the main project is the project that is first deployed. To run a project, package, or file, choose one of the following:
When you run the project the IDE displays any compilation errors and output in the Output window. For more, see Fixing Compilation Errors.
By default, the IDE does not specify a main class, runtime arguments, or JVM arguments. The runtime classpath of each standard project contains the project's compiled classes and everything in the project's compilation classpath. You can view the project's compilation classpath by opening the Project Properties dialog box and selecting the Libraries node in the Categories pane and then clicking the Compile tab in the right pane.
To change project runtime options, open the Project Properties dialog box by right-clicking the project node in the Projects window and choosing Properties. Next, select the Libraries node in the Categories pane and click the Run tab in the right pane of the dialog box. Note that to access settings for the main class, program arguments, the working directory for program execution and VM options, you have to select the Run node. In the next section we'll take a closer look at how to configure the runtime classpath
Specify the runtime settings in the Project Properties dialog box
To add projects, libraries, JAR files, and folders to the project's runtime classpath, use the buttons on the right side of the Run-time Libraries list in the Project Properties dialog box.
If your project uses special libraries dynamically at runtime through an indirect interface or reflection (like JDBC drivers or JAXP implementations), you have to add these libraries to the runtime classpath. You also have to adjust your runtime classpath if the runtime dependencies between your projects do not match the compilation dependencies between the projects. For example, imagine that project A compiles against project B, and project B compiles against project C, but project A does not compile against project C. This means that project A only has project B on its runtime classpath. If project A requires both project B and project C during execution, you have to add project C to project A's runtime classpath.
In free-form projects, your Ant script handles the classpath for all of your source folders. The classpath settings for free-form projects in the Project Properties dialog box only tell the IDE what classes to make available for code completion and refactoring. For more, see Managing the Classpath in Free-form Projects.
To set the project's main class, select the Run node in the Categories pane of the Project Properties dialog box and type the fully-qualified name in the Main Class field (for example, org.myCompany.myLib.MyLibClass ). The main class must exist in the project or in one of the JAR files or libraries in the project's runtime classpath. Afterwards, type any necessary runtime arguments in the Arguments field.
If you use the Browse button to choose the project main class, the file chooser only shows classes in your project source directory. If you want to specify a class in one the libraries on the classpath, you have to type the fully-qualified name of the class in the Main Class field.
You can specify JVM arguments for the project in the Project Properties dialog box. Open the Project Properties dialog box and click Run in the Categories pane and then type a space-separated list of JVM arguments in the VM Options field.
You can set system properties by typing the following in the VM Options field:
-Dname=value