I have two java projects in eclipse, P1 and P2. P1 is the main project and P2 is subordinate to P1. After project compilation, I need classes of P2 in classpath of P1. How can I achive this?
Asked
Active
Viewed 633 times
0
-
You want the child class to be involved inside the parent class? – Afzaal Ahmad Zeeshan Aug 21 '14 at 10:06
-
Yes classes of child project in the same location as that of parent project. – Jay Aug 21 '14 at 10:07
-
Are you using any Build tool for building your applications ? As example making parent-child projects is possible with maven. You can refer to [SO-Link](http://stackoverflow.com/questions/3209119/creating-multi-module-maven-projects-in-eclipse). – Mandar Pandit Aug 21 '14 at 10:07
-
After compilation, you can do that. Before compilation I think you can move the code through the directories! :) – Afzaal Ahmad Zeeshan Aug 21 '14 at 10:08
-
1It is also possible without maven. You just have to add project here :Project>Properties>Java Build Path > Projects. – Jay Aug 21 '14 at 10:09
1 Answers
1
In Eclipse you can make add project P2 to the classpath of P1 by rightclicking on the project P1 in the Package Explorer view. Then choose Build Path->Configure Build Path and in the second tab ('Projects') add project P2.

Marcin Krasowski
- 668
- 6
- 12