Nesting resources in output directory

Layout on file system

Steps for defining a corresponding project

  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 "Product" in the Project name field. Click Next.
  4. On the next page, Select "Product" source folder and click Remove.

    Type "Product/deliverables" in Default output folder field.

    Then click on Add Folder....

  5. In New Source Folder dialog, type "sources" in the Folder name field.

    Click Advanced. Check Link to folder in the file system.

    Click Browse.... and choose the "sources" directory in "Product".

    New linked folder

  6. Click OK to close the dialog.

  7. Click again on Add Folder....

    Source and output folders page

  8. In Source Folder Selection dialog, click on Create New Folder...

    Type "deliverables" in the Folder name field.

    Click Advanced. Check Link to folder in the file system.

    Click Browse.... and choose the "deliverables" directory in "Product".

    New linked folder

  9. Click OK twice to close the two dialogs.

  10. You project setup now looks as follows:

    Source and output folders page after setting folder

  11. Expand "Product/deliverables" and select Excluded

    Click on Edit... and click on Add... in Exclusion patterns part of the Inclusion and Exclusion Patterns dialog

    Type "libraries/" in Add Exclusion Pattern dialog and click OK to validate and close the dialog

    Add Exclusion Pattern

  12. Click OK to close the dialog.

  13. Your project source setup now looks as follows:

    Project source and output setup

  14. Click Finish.
  15. Open project properties (using Alt-Enter or contextual menu)

    Select Java Build Path page and go to Libraries tab

    Click on Add JARs... and expand "Product" hierarchy to select jar files in "libraries" directory

    Add Library to Build Path

  16. Click OK.
  17. You now have a Java project with a "sources" folder and an output folder which contains nested library resources.

    Java perspective

Related concepts

Java projects
Java views

Related tasks

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

Related reference

New Java Project Wizard
Package Explorer View

Legal notices