You are on page 1of 1

Setting Up a Java Project Based on Existing Sources

To set up a Java project that may have been developed outside of NetBeans,
use the "Existing Sources" template in the “New Project” wizard to create a
new NetBeans project. In the wizard, you will identify the location of the
sources and specify a location for the NetBeans project metadata. You can
then use the Project Properties dialog box to Configure the project.

To set up a NetBeans project for an existing Java application:

1. Choose File > New Project (Ctrl-Shift-N on Windows/Cmd-Shift-N


on OS X).
2. Choose Java > Java Project with Existing Sources. Click Next.
3. In the Name and Location page of the wizard, follow these steps:
o Type a project name.
o (Optional) Change the location of the project folder.
o (Optional) Change the name of the build script used by the IDE.
This might be desirable if there is already a build script called
build.xml that is used to build the sources.
o (Optional) Check the Use Dedicated Folder for Storing
Libraries checkbox and specify the location for the libraries folder.
See Sharing Project Libraries for more information on this option.
o (Optional) Select the Set as Main Project checkbox. When you
select this option, keyboard shortcuts for commands such as Clean
and Build Main Project (Shift-F11) will be applied to this project.
4. Click Next > to advance to the Existing Sources page of the wizard.
5. In the Source Packages Folder pane, click Add Folder. Then navigate to
your sources and select the source roots, click Open.

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.mycompany.myapp.ui package, you add the folder that contains
the com folder.

6. (Optional) In the Test Package Folders: pane, click Add Folder... to


select the folder containing the JUnit package folders.
7. Click Next to advance to the Includes: & Excludes: page of the wizard.
8. (Optional) In the Includes: & Excludes: page of the wizard, enter file
name patterns for any files that should be included or excluded from the
project. By default, all files in your source roots are included.
9. Click Finish.

You might also like