I have two Java projects in an Eclipse workspace, and I would like to use a class from one of them in the other.
How can I add a reference between them? I'm looking for something like adding a project reference in C#.
Right click on Project1, then click on Properties. In the dialog that comes up, select Java Build Path, and then click on the Projects tab. There, add Project2 to the build path. If Project1 is a web app, you need to make sure your Deployment Assembly (same Properties UI) has Project2 there as well.
Assuming you are using Eclipse...
Right click the project -> Properties -> Java Build Path -> Projects tab
...which will allow you to force required projects on the project in questions build path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With