Linking two projects in Eclipse

Today I needed to link two projects in Eclipse ,basically Java classes of my  one project was refering to  another project. For debugging  I wanted to link the source. As always  i just googled but suprised not  to find this easy thing. I got it working soon and just wanted to share it.

Well  first I tried to attach the source with the jar  I was using  in the second project but there was a limitation, I could not inspect the local variables but just the instance variables.With linking the project inspecting is not a problem.

Let us start now !

Create the two projects :

I am just creating two projects P1 and P2

View of Project Explorer

I want to  refer Class A in P1 from Class B  P2. So to link P1 with P2 ,

Right Click P2 >> Properties >> Java Build Path >> Click tab Projects

Click Add.The Open projects would be shown in the list and we can choose the needed from there

Click Ok Done

Easy 🙂 .