Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java eclipse build path options question

I have a question on Eclipse (I am using Helios).
When a project depends on various libraries, we add them to the classpath via the Build Path Dialog.
In the same dialog though, there is a tab for Projects (Required Projects on the build path).
It is not clear to me, when someone would add such a reference from one project to another.
I mean, if projectA needs functionality from projectB, then we can make a jar out of projectB and use it in projectA.
But when, would we add then, a reference from projectA to projectB, in order to need projectB in the build path of projectA?
Could someone please give an example?
Thank you!

like image 818
Cratylus Avatar asked Jan 26 '11 20:01

Cratylus


People also ask

What should be the build path in eclipse?

Procedure. In Eclipse select the web project and right-click Build Path > Configure Build Path. This will display the Java Build Path window. Add the CICS and Liberty libraries, click Add Library > CICS Liberty libraries > Next > Finish.

How do I add missing build path entries in eclipse?

Right-click on the project and choose properties. Click on the Java Build Path option in the left side menu. From the Java Build Path window, click on the Libraries Tab. Make sure JRE System library is listed, if it is not listed then you can add, by clicking "Add Library" from the right side menu.


1 Answers

Well, there are two reasons for depending on a project.

  1. You can "click through" to the source code of the other project when its code is invoked.
  2. If you're building and running the application in Eclipse for dev purposes, changes in the code will instantly be picked up.

Update: I thought of a third one, possibly even better than the first two. There is an "Order and Export" tab in the same screen, where you can select which elements of a project's classpath are exported. And what "exported" means here is exactly that if project B is configured to have project A as a dependency, then it will automatically add all the exported libraries from project A to its own classpath. So if project A has a lot of thrid party libraries, you don't have to manually add them to project B's classpath.

like image 80
biziclop Avatar answered Sep 23 '22 10:09

biziclop