开发者

importing project in Eclipse

开发者 https://www.devze.com 2023-01-03 04:18 出处:网络
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

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 projec开发者_运维技巧t? Are there other alternatives?


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.


  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.
0

精彩评论

暂无评论...
验证码 换一张
取 消