Open a Java perspective, select the menu item File > New > Project.... to open the New Project wizard.
Select Java project in the list of wizards and click Next.
On the next page, type "Framework" in the Project name field.
In Contents group, change selection to Create project from existing source.
Click Browse... and choose the D:\Framework
directory.
Click Next.
On the next page, verify that directory JavaSourceFiles
has been automatically added as source folder.
Expand it to preview your project source folder contents:
In Java perspective, type Ctrl+N to open New wizards dialog.
Select Java project in the list of wizards and click Next.
On the next page, type "Product" in the Project name field.
In Contents group, change selection to Create project from existing source.
Click Browse... and choose the D:\Product
directory.
Click Next.
Let's add a dependency to source framework project...
On the next page, verify that directory JavaSourceFiles
has been automatically added as source folder.
Select Projects tab.
Click Add....
In Required Project Selection, check "Framework".
Click OK.
Now, let's put access rules on source framework content to authorize, discourage or forbid access to "Framework" source folders, package and classes...
In Projects tab, select "Access rules" of "Framework" depending project.
Click Edit....
In Type Access Rules, click Add....
In Edit Access Rule, select "Forbidden" for Resolution.
Type "**/forbidden/**" in Rule Pattern field.
Click OK.
Add another access rule:
Resolution: "Discouraged" and Rule Pattern: "**/internal/**".
Your access rules now look as follows:
Click OK.
Dependent project has now 2 access rules set.
Click Finish.
You now have a Java project which contains the source of "Product" and which is using the source of "Framework".
Some packages of the project "Framework" are restricted and if you try to import them, compiler displays either warnings or errors depending on your restriction level:
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