Anto
Anto

Reputation: 4305

importing project in Eclipse

Hello I am new to Eclipse (and I am a novice in Java): I am creating a project which should make use of some classes from another project. Do I have to export necessarily this last project as JAR file and add in my project? Are there other alternatives?

Upvotes: 0

Views: 153

Answers (2)

sleske
sleske

Reputation: 83577

There are several alternatives:

  • If project A depends on project B, and both projects are in the same Eclipse workspace, you can just project B to project A's build path (project properties / build path / project). This has the nice advantage that it will (optionally) automatically pull in project B's JARs, plus updates to B will be used automatically by A, and you can debug into B's code (even using hot code replace).
  • If A and B are fairly separate, just make B into a JAR (or several ones), then add these to A's build path.

Upvotes: 1

nobody
nobody

Reputation: 1949

  1. If you have the source of those class files you can just link that source
  2. Or add the other project as a dependent project.
  3. Or create a jar of those classes and add that in lib.

Upvotes: 0

Related Questions