# Creating a new source folder with exclusion filter

In a project that uses source folders, you can create a new folder to contain Java source code with exclusion patterns. Exclusion patterns are useful if you have nested source folders. There are two ways to do it:

1. You don't already have an existing Java project in which you want to create a source folder with exclusion pattern.
2. You already have an existing Java project.

## Starting from scratch

1. First follow the steps of the task "Creating a new source folder".
2. Once a first source folder is created, if you want to create another source folder that is nested inside the first one, you need to use the exclusion pattern.
3. Open the Java Build Path page (Project > Properties > Java Build Path) and click the Source tab.
4. Click Add Folder, select an existing source folder, and click Create New Folder to create a folder that is nested inside the first one.
5. You will get a dialog saying that exclusion filter has been added to the first source folder.

   > NOTE: The trailing '/' at the end of the exclusion pattern is required to exclude the children of this folder. The exclusion pattern follows the ant exclusion pattern syntax.

6. Click OK and Finish when you are done.

## From an existing Java Project

1. Before you start, make sure that your project properties are enabled to handle exclusion filters in source folders.
2. In the Package Explorer, select the project where you want the new source folder to reside.
3. From the project's pop-up menu, select New > Source Folder. The New Source Folder wizard opens.
4. In the Project Name field, the name of the selected project appears. If you need to edit this field, you can either type a path or click Browse to choose a project that uses source folders.
5. In the Folder Name field, type a name for the new source folder. If you choose a path that is nested inside an existing source folder, you will see an error saying that you have nested source folders.
6. Check Update exclusion filters in other source folders to solve nesting.
7. Click Finish when you are done.

Java projects

Creating Java elements
Creating a new Java project
Creating a new Java package
Creating a Java project as its own source container
Creating a Java project with source folders
Creating a new source folder

New Source Folder wizard
Java Toolbar actions
Package Explorer