
Setting to java-name and making it relative to src.dir creates a fully-qualified class name for the currently selected file.įor standard projects that have a main class is specified, the IDE automatically copies any JAR files on the project's classpath to the dist/lib folder. Since java can only take single file, you set to.

now stores the context in the classname property. Then you map the debug-selected-files target to the debug.single action: Instead of passing the program main class to java, you pass the classname property, which is set by the IDE to the currently selected file. This is basically the same as the debug target. The debug-selected-files target looks something like this: The process is basically the same for writing targets to debug and run a single file. $ specifies that the file name should be relative to the src.dir directory and that this action is only enabled for the src.dir directory. Relative-path-noext - Same as relative-path, but the file's extension is removedĪbsolute-path-noext - Same as absolute-path, but the file's extension is removed Relative-path - specifies that the IDE should pass the relative file name to the target Other formatting options include the following: Java-name specifies that the IDE should pass the relative file name to the target but delimited by periods (.) and without an extension. If you want the property to be able to hold more than one file (such as for the Compile File target), you can use the following, where the comma (,) is the separator between file names: specifies that runclass can hold only one file. This property must be set by the IDE before the target can be run. You can choose any unique name for this property. Runclass is the name of the property that holds the context.

In this case, it is the name of file that you want to run. sets the context on which the Ant target is executed. maps the Run File command and the F9 shortcut to the run-selected-file target. Now let's take a look at the following lines to see how it works. The runclass property is a newly defined property that holds the file that you want to run and is referenced by the java task.
WAITING FOR CONNECTION NETBEANS XDEBUG HOW TO
First we will look at how to do this and then we will explain it in detail: You store this reference in the same place where you map the build target ( run-selected-file) to the IDE action. For example, the run-selected-file target above looks for the currently selected file in the runclass property. Once you have an Ant target for running the selected file, you have to get a reference to that file in the IDE and store it in a property. You can select multiple projects in the Projects window and run them at once by choosing Run > Run ( number of selected projects) Projects (F6) from the main IDE's menu.ġ0.4.1.2 Getting a Reference to the Currently Selected File in the IDE If you are running a project often, you can set a project as the main project by choosing Run > Set Main Project from the main menu and selecting the project in the submenu or by right-clicking the project node in the Projects window and choosing Set as Main Project. For information on setting the classpath, see Section 10.5, "Setting the Runtime Classpath."


Each project can contain only one main class. You can change this setting in the Run panel of the project's Project Properties dialog box. If you run a project for which you have not specified a main class, the IDE prompts you for the main class. If Compile on Save is not selected, the project is run using the project's build script. If you have the Compile on Save option selected in the Compiling section of the Project Properties window, the project is run directly from the build/classes directory of your project. When running an application, be aware of the following considerations: Select the project that you want to run in the Projects window. For information on setting the main class, see Section 10.6, "Setting the Main Class and Runtime Arguments." You can run the project or run any individual project that contains an executable class. With standard projects, you typically have one project that contains the application main class and several projects containing class libraries.
