Netbeans

Basic Project Concepts

This section provides an overview of some background information on the IDE’s project system.

Projects

In the IDE, you always work inside of a project. In addition to source files, an IDE project contains metadata about what belongs on the classpath, how to build and run the project, and so on. The IDE stores project information in a project folder which includes an Ant build script and properties file that control the build and run settings, and a project.xml file that maps Ant targets to IDE commands.

Note: Though the IDE puts source directories within the project folder by default, your source directories do not necessarily need to be located in the project folder.

Ant

Apache Ant is a Java-based build tool used to standardize and automate build and run environments for development. The IDE’s project system is based directly on Ant. All of the project commands, like Clean and Build Project and Debug, call targets in the project’s Ant script. You can therefore build and run your project outside the IDE exactly as it is built and run inside the IDE.

It is not necessary to know Ant to work with the IDE. You can set all the basic compilation and runtime options in the project’s Project Properties dialog box and the IDE automatically updates your project’s Ant script. If you are familiar with Ant, you can customize a standard project’s Ant script or write your own Ant script for a project.

Creating a Project

To create a new project:

  • Choose File > New Project (Ctrl-Shift-N).

When the New Project wizard appears, simply select the right template for your project and complete the remaining wizard steps.

The IDE contains the following standard project templates for Java desktop and web applications:

In addition, the IDE also contains templates for EJB modules, enterprise applications, Java ME applications, and more.

The Java and Web project categories also have free-form project templates. The free-form templates enable you to use an existing Ant script for a project but require manual configuration. See Free-form Projects below.

When you finish creating a project, it opens in the IDE with its logical structure displayed in the Projects window and its file structure displayed in the Files window:

  • The Projects window is the main entry point to your project sources. It shows a logical view of important project contents such as Java packages and Web pages. You can right-click any project node to access a popup menu of commands for building, running, and debugging the project, as well as opening the Project Properties dialog box. The Projects window can be opened by choosing Window > Projects (Ctrl-1).
  • The Files window shows a directory-based view of your projects, including files and folders that are not displayed in the Projects window. From the Files window, you can open and edit your project configuration files, such as the project’s build script and properties file. You can also view build output like compiled classes, JAR files, WAR files, and generated Javadoc documentation. The Files window can be opened by choosing Window > Files (Ctrl-2).

Leave a Comment