|
When you add a folder containing source code, you must add the folder that
contains the highest folder in your package tree for example, for the
com.jcardshark.blackjack.ui package, you add the folder that
contains the com folder.
You can only have one source folder and one JUnit test folder in each project. To work with multiple source folders, create a project for each source folder and put the projects on each other's classpath as necessary.
You can have multiple source folders and define complex classpath relationships between folders. The source folders can exist anywhere on disk and can be added and removed after the project is created.
The project folder contains the Ant script and properties files that control how your project is built and run.
The project folder contains two Ant scripts:
The project folder also contains the output folder for compiled classes, JAR files (for J2SE projects) or WAR files (for web projects) files, and Javadoc.
When you specify the Location in the free-form project, this location does not necessarily need to be the folder that contains the Ant script. For example, if you have all of your source package folders organized into one folder, you could set that folder as the project location even if it does not contain the Ant build script. The location of the output folders depends on how your Ant script is configured.
The web module root is the top-level folder of a web application. It is where your JSP pages, client-side classes and archives, and static web resources, such as images, are stored. The illustration below shows the source structure of a typical web application.

When your application is organized into several projects, the main project serves as the entry point to the application. Usually, the main project contains the main class that starts the application. Many menu commands such as Run and Build have keyboard shortcuts to the main project. You can also access all commands for individual projects by right-clicking their project nodes in the Projects window.
To make a project the main project, right-click the project's node in the Projects window and choose Set as Main Project.
Free-form projects rely on your Ant script to provide targets for all IDE actions, including:
If your Ant script does not contain targets for any of these actions, the commands are disabled in the IDE. You can easily write targets for these commands and then associate them with the commands in the project's Project Properties dialog box.
If you cannot edit your Ant script to include the new targets, you can write a secondary Ant script containing the targets. For more information, see Advanced Free-Form Project Configuration.
The Projects window shows a package-based view of your projects. You can right-click the project node to run commands on the project. You can configure project options by right-clicking the project node and choosing Properties.
The Files window shows you the physical layout of your project files on disk.
The project folder and each of your source folders are displayed for each
of your projects. The nbproject folder contains project metadata
for your project.
When you add classes to a project's classpath, the IDE makes these classes available for code completion and refactoring. You can add the following types of classpath elements to a project:
Your Ant script must explicitly handle the classpath elements for compilation and execution. The classpath settings that you enter when creating the project are used to provide code completion, error highlighting, and refactoring for your project. These classpath settings must match the classpath definition in your Ant script. You can set one classpath for the entire project or set the classpath for each individual source folder in your project. To declare the classpath for an existing free-form project, right-click the project node in the Projects window and choose Properties. Then click Classpath and set the classpath for each source root.
The context provides a way to distinguish resources in one web application from resources in others that are deployed on the same server instance.
The context of an application determines the URL namespace of the contents of the web application. When a web application's context property value is set, you access the web module at http://hostname:port/context/servlet_or_jsp. For example, with the property value set to /HelloWeb, you access the web application at http://hostname:port/HelloWeb/index.jsp.