# Overlapping products in a common source tree

### Layout on file system

- The Java source files for products are all held in a single main directory.
- Products are separated into four siblings packages `Product1`, `Product2`, `Product3` and `Product4`.

### Steps for defining corresponding "Product1" and "Product2" projects

1. Open a Java perspective, select the menu item File > New > Project.... to open the New Project wizard.

2. Select Java project in the list of wizards and click Next.

3. On the next page, type "Product1" in the Project name field. Click Next.

4. On the next page, Select "Product1" source folder.

   Click Link Additional Source to Project button in view bar.

5. In Link Additional Source click Browse.... and choose the `D:\AllJavaSourceFiles` directory.

   Type "src" in Folder name.

6. Click OK to close the dialog.

7. Click OK in confirmation dialog to have "Product1/bin" as default output folder.

8. Expand the "src" source folder. Select all packages you want to exclude and exclude them using popup-menu.

9. Your project source setup now looks as follows:

10. Click Finish.

11. Copy "Product1" project and paste it as "Product2".

    Edit "Product2" project properties and go on Java Build Path page.

    Select Excluded and click Edit....

12. In Inclusion and Exclusion Patterns, select "com/xyz/product2" and click Edit....

13. Change "com/xyz/product2" to "com/xyz/product1" instead.

14. Click OK three times to valid and close all dialogs.

15. You now have two Java projects which respectively contain the sources of "product1", "product2".

Java projects
Java views

Working with build paths
Creating a new Java project
Creating a Java project with source folders
Creating a new source folder
Using the Package Explorer

New Java Project Wizard
Package Explorer View