Java Build Path

The options in this page indicate the build path settings for a Java project. You can reach this page through the project properties (Project > Properties > Java Build Path) from the context menu on a created project or the File menu of the workbench.

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

For projects targeting Java 9 or greater, entries on the Projects and Libraries tabs can be placed either on the traditional Classpath or on the Modulepath. Entries on the Modulepath are interpreted as modules according to the Java Platform Module System. For these, further details can be edited via Modularity Details.

This property page consists of the following tabs:

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

Source folder options:
Option Description
Add Folder Creates a new folder to contain source
Link Source Creates a new folder that links to an location outside of the workspace
Edit or Toggle Allows to modify the currently selected source folder or source folder attribute.
Remove Removes the selected folders from the class path. This does not delete the folders nor their contents.
Allow output folder per source folder Shows/Hides the 'output folder' attribute of the source folders

Source folder attributes:
Attribute Description
Exclusion filter Selects which resources are not visible to the compiler. For details see Inclusion and exclusion patterns.
Output folder Only available when Allow output folder per source folder is checked. Defines a source folder specific output location. If not set the project's default output folder is used.
Native library location Defines the folder that contains the native libraries (for example 'dll' or 'o' files) required at runtime by the sources in the source folder.
Ignore optional compile problems When set to 'Yes', all optional problems will not be reported by the compiler.
Contains test sources When set to 'Yes', the sources in the folder are assumed to be test code, otherwise main code. When compiling main code, only other main code (from the current project or from other projects on the build path) is visible and only dependencies that are not configured to be visible for test code only. When compiling test code, all code on build path is visible. When compiling test code with Java 9, the unnamed module is assumed to be readable by the current module, so test dependencies that should not be mentioned in the module-info.java are accessible if they are put on the classpath.

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.

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 or Toggle Edit the classpath attribute of a required project.
Remove Removes the selected required projects from the list.
Project entry attributes:
Attribute Description
Native library location Specifies where native library required for the project to operate can be found.
Is modular / Is not modular Specifies whether the project should be treated as a module. Double-click to edit Modularity Details.
Access rules Specifies access rules for project contained in the library. This allows to hide content of a project.
Visible only for test sources When set to 'Yes', the code reachable via the referenced project is only accessible when sources in sources folder marked to contain test code are compiled.
Without test code When this is set to 'Yes', test code from the referenced project is not visible when compiling test code in the current project.

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.
Add External Class Folder Allows to navigate the file system (outside the workbench) and select a class folder for the build path. The selection dialog also allows you to create a new folder.
Edit or Toggle 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 File 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
Source attachment Specifies where the library's source can be found.
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.
External annotations Specifies where external annotations for the library can be found. If specified these annotations will be considered by JDT for its static null analysis.
Native library location Specifies where native library required for the library to operate can be found.
Is modular / Is not modular Specifies whether the library should be treated as a module (or several modules). Double-click to edit Modularity Details.
Access rules Specifies access rules for resources contained in the library. This allows to hide content of a library.
Visible only for test sources When set to 'Yes', the code in the referenced library is only accessible when sources in source folders marked to contain test code are compiled.

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.

Module Dependencies Tab

For projects targeting Java 9 or greater this page visualizes module-related aspects of all dependencies of the current project. At the left the All Modules list shows all modules that are considered when building the current projects. At the right Details of a selected module are shown, along with buttons to modify these details.

The All Modules list uses the following icon decorations to distinguish different kinds of modules:

Decorated IconMeaning
focus module The focus module, i.e., the module implemented by the current project. This module will always be shown at the top of the list, followed by other modules in alphabetical order.
system module A system module, i.e., a module provided by the Java System Library.
automatic module An automatic module, i.e., a module that is not declared using module-info.java, but inferred from information like the file name of a jar archive, or an attribute in MANIFEST.MF and the list of contained, non-empty packages.

Operations offered for the All Modules list:

Modules that have just been added to the Modulepath on the corresponding tab of this page, will not be visible in this list immediately. In this case you need to click Apply to update the All Modules list.

The Details tree has two root nodes:

The elements in this part of the page are marked with one of the following decorated icons:

Decorated IconMeaning
reads module A module which the selected module reads. This corresponds to a requires declaration.
exports package A package which the selected module exports to other modules, possibly qualified with a list of modules to which the package is exclusively exported. This corresponds to an exports or exports _ to declaration.
opens package A package which the selected module opens to other modules (for reflection), possibly qualified with a list of modules to which the package is exclusively opened. This corresponds to an opens or opens _ to declaration.
patches module A project (or source folder) that patches the selected module, i.e., all types in that project (or source folder) will be associated with, and compiled as part of the selected module.

Operations offered for the Details tree, provided that a module has been selected in the All Modules list:

Build classpath
Classpath variables
Inclusion and exclusion patterns Modularity details (deprecated)
Frequently asked questions on JDT
Classpath variables preferences
Build path preferences
Compiler preferences