# Java Build Path page

The options in this page indicate the build path settings for a Java project. You can reach this page through the New Java Project wizard.

The build class path is a list of paths visible to the compiler when building the project.

## Source tab

Source folders are top-level folders in the project hierarchy. They are the root of packages containing .java files. The compiler will translate the contained files to .class files that will be written to the output folder.

Source folders allow to structure the project, for example to separate test from the application in two source folders. Within a source folder, a more detailed structuring can be acived by using packages.

Each source folder can define an exclusion filter to specify which resources inside the folder should not be visible to the compiler.

Resources existing in source folders are copied to the output folder unless the setting in the Java > Compiler > Building preference page specifies that the resource is filtered. The output folder is defined per project except if a source folder specifies its own output folder.

The tree shows the project as it will look like when switching to the package explorer. Several operations can be executed on this tree to change the structure of the project.

Icon | Option | Description
--- | --- | ---
| Add source folder | Add a folder to the Java build path as source folder.
| Link additional source to project | Add a link to a folder in the file system as source folder to the Java build path.
| Remove from buildpath | Remove a source folder from the Java build path and change it into a normal folder.
| Exclude | Add a resource to the exclusion filter of it's parent source folder. The excluded resource and all its children are no longer visible to the compiler.
| Include | Includes a previously excluded resource.
| Configure source folder properties | The edit source folder property menu has two actions Configure Inclusion / Exclusions Filters: Customize the inclusion and exclusion filters by defining string patterns. It is possible to use wildcard in patters (i.e. to exclude all java files which start with "Test" write "Test*.java"). Configure Output Folder: Change the output folder for a source folder. This action is only enabled if Allow output folders for source folders is enabled.
| Undo all changes | All changes that have been applied to the project in this wizard will be withdrawn and the original state of the project is reconstructed.
| Allow output folders for source folders | If enabled, each source folder can have its own output folder. Otherwise all source folders will use the default output folder.

A shorter description of all operations is visible in the Details pane below the project tree.

## Projects tab

In the Required projects on the build path list, you can add project dependencies by selecting other workbench projects to add to the build path for this new project.

Adding a required project indirectly adds all its classpath entries marked as 'exported'. Setting a classpath entry as exported is done in the Order and Export tab.

The projects selected here are automatically added to the referenced projects list. The referenced project list is used to determine the build order. A project is always build after all its referenced projects are built.

Action | Description
--- | ---
Add | Add another project in the workspace to the build path of this project.
Edit | Edit the classpath attribute of a required project.
Remove | Removes the selected required projects from the list.

## Libraries tab

On this page, you can add libraries to the build path.

By default, the library list contains an entry representing the Java runtime library. This entry points to the JRE selected as the default JRE. The default JRE is configured in the Java > Debug > Installed JREs preferences page.

Libraries tab options
Option | Description
--- | ---
Add JARs | Allows you to navigate the workbench hierarchy and select JAR files to add to the build path.
Add External JARs | Allows you to navigate the file system (outside the workbench) and select JAR files to add to the build path.
Add Variable | Allows you to add classpath variables to the build path. Classpath variables are an indirection to JARs with the benefit of avoiding local file system paths in a classpath. This is needed when projects are shared in a team. Variables can be created and edited in the Java > Build Path > Classpath Variables preference page.
Add Library | Allows to add a predefined libraries like the JRE System Library. Such libraries can stand for an arbitrary number of entries (visible as children node of the library node)
Add Class Folder | Allows to navigate the workbench hierarchy and select a class folder for the build path. The selection dialog also allows you to create a new folder.
Edit | Allows you to modify the currently selected library entry or entry attribute
Remove | Removes the selected element from the build path. This does not delete the resource.
Migrate Jar | Migrate a jar on the build path to a newer version. If the newer version contains refactoring scripts the refactoring stored in the script will be executed.

Libraries have the following attributes (presented as library entry children nodes):

Library entry attributes
Attribute | Description
--- | ---
Javadoc location | Specifies where the library's Javadoc documentation can be found. If specified you can use Shift+F2 on an element of this library to open its documentation.
Source attachment | Specifies where the library's source can be found.
Native library location | Specifies where native library required for the library to operate can be found.
Access rules | Specifies access rules for resources contained in the library. This allows to hide content of a library.

## Order and Export tab

In the Build class path order list, you can click the Up and Down buttons to move the selected path entry up or down in the build path order for this new project.

Checked list entries are marked as exported. Exported entries are visible to projects that require the project. Use the Select All and Deselect All to change the checked state of all entries. Source folders are always exported, and can not be deselected.

Build classpath
Classpath variables

Frequently asked questions on JDT
Classpath Variables preferences
Java Compiler properties