# 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 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. The output folder is defined per project except if a source folder specifies an own output folder. 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 also copied to the output folder unless the setting in the Compiler preference page ( Java > Compiler > Building) specifies that the resource is filtered.

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 to build path | Allows to add a folder or package to the Java build path and change it to a source folder. A source folder is a top-level folder in the project hierarchy that is used as the root of packages. Entries on the build path like source folders are visible to the compiler and all contained resources like .java files are used to build the project. 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 done by using packages.
| Remove from buildpath | Allows to remove a source folder from the Java build path and change it into a normal folder. All contained resources in this folder (like .java files) are no longer visible to the compiler and will not be included when building the project.
| Exclude | Allows to add a resource to the exclusion filter of it's parent source folder. The consequence is that all children of this resource are no longer visible to the compiler. This operation can be useful if for example, some packages are not needed in the project and can therefore be hidden from the compiler.
| Include | This action is available on files or folders that have been excluded. In this situation, include allows to make this resources again visible to the compiler.
| Configure source folder properties | Editing can be used in two situations: Customize the inclusion and exclusion filters by defining string patterns. This can be useful if including or excluding every single resource would take too long and just some simple patterns can do the job. A very practical operator is the wildcard operator to define more sophisticated patterns (for example exclude all resources that start with "Test*.java"). Change the output folder for a source folder. The consequence is that all generated .class files from the .java files in this source folder are will be generated in the separate output folder instead of the project's output folder. Note that this advanced action is only available on single selected objects.
| 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.
| Link additional source to project | When creating a project, there are might already exist some pieces of code or other resources somewhere in the file system that could also be used for this new project. To add this sources to the project, it is possible to create a linked source folder to the folder in the file system and make its content visible to the compiler. Note that only a link to the folder is created. This means that any modifications on resources in that folder will also have an impact on other projects also using this resources.
No icon | Allow output folders for source folders | Shows/Hides the 'output folder' attribute of the source folders. If no output folders are shown, this means that the project's default output folder is used for the generated .class files.

Note that a shorter description of all operations is visible in the area at the bottom of the project tree (labeled with 'Description'). Only the descriptions which are valid for the current selection on the project are shown. For experienced users it is also possible to close the description area to view the projects structure enlarged.

## 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. The Select All and Deselect All buttons can be used to add or remove all other projects to or from the build path.

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.

## Libraries tab

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

- Workbench-managed (internal) JAR files
- File system (external) JAR files
- Folders containing CLASS files
- Predefined libraries like the JRE System Library

JAR files can also be added indirectly as class path variables.

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 Installed JREs preferences page (Window > Preferences > Java > Installed JREs)

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 Classpath Variable preference page ( Java > Build Path > Classpath Variables)
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.

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.

## 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.

## Default output folder

At the bottom of this page, the Default output folder field allows you to enter a path to a folder path where the compilation output for this project will reside. The default output is used for source folders that do not specify an own output folder. Use Browse to select an existing location from the current project.

Build classpath
Classpath variables

Frequently asked questions on JDT
Classpath Variables preferences
Java Compiler properties