Object-Oriented and Web Programming with Java

HRS2422

Creating a project in NetBeans

1.The following link illustrates the creation of a project in NetBeans:

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.

For instructions on using the New Project wizard, see the following documents:

  • Quick Start Guide
  • Quick Start Guide for Web Applications

Because NetBeans' post-3.6 projects structure is so different from the earlier versions, automatic importing of NetBeans IDE 3.6 projects is not implemented. To import the source code you were working on in version 3.6, create a new project for each source package root (or if you have your own Ant script, one free-form project for the entire application). For more information on importing source code into the IDE, see the following documents:

  • Importing Existing Java Source Code into NetBeans IDE
  • Importing Existing Web Applications into NetBeans IDE

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 contextual 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).

In addition, you can use the Favorites window to you access any location on your computer. This is handy for accessing files and directories that are outside of your project directories. The Favorites window does not know anything about project classpath and membership, so none of the project-related commands like Compile File are available. You can open the Favorites window by choosing Window> Favorites (Ctrl-3).

  • Setting the Main Project

When you develop a large application consisting of numerous source folders, it is common to split up your code into separate projects. Typically, one of these projects serves as the entry point for your application and, if it is a J2SE application, contains the application's main class. To tell the IDE which of your projects is the main entry point for your application, you set one project to be the main project. The IDE provides commands that act on the main project. For example, running the Build Main Project command builds both the main project and all of its required projects, thereby ensuring that all of your compiled classes are up-to-date. To set a project as the main project, right-click the project node in the Projects window, and choose Set as Main Project. Only one project can be the main project at any time.[1]

[1]