-
Click
Window > Open Perspective > Other... > Java
to change to the Java perspective.
-
Click
File > New > Other... > Java Project
to open the New Java Project wizard.
-
Type "Product1" in the Project name field. Click Next.
-
On the next page, Select "Product1" source folder.
Click Link additional source link in Details pane or button in view bar.
-
In Link Source click Browse.... and choose the
D:\AllJavaSourceFiles
directory.
Type "src" in Folder name.
-
Click Finish to validate and close the dialog.
-
Expand the "src" source folder. Select the three last packages and exclude them from build path
using either Exclude from build path link or Exclude popup-menu item.
-
Your project source setup now looks as follows:
-
Click Finish.
-
Copy "Product1" project and paste it as "Product2".
Edit "Product2" project properties and go on Java Build Path page.
In Source tab, expand "Product2/src" source folder, select Excluded and click Edit....
-
In Inclusion and Exclusion Patterns, select "com/xyz/product2" and click Edit....
-
Change "com/xyz/product2" to "com/xyz/product1".
-
Click OK to enter the change.
Click Finish to validate and close Inclusion and Exclusion Patterns dialog.
Click OK again to validate "Product2" project properties changes.
-
You now have two Java projects which respectively contain the sources of "product1", "product2".