I have project A: in project I hava a package A. (In project folder, it’s just a folder A with many *.java).
I create a project B: how I import folder A to project B to use modules I have created. (If I create package A from project A: I must compile each file to *.class, and I cannot modified source code again, and that not what I want).
This work frustrate me so much. Because I often do step by step (in Project B): create a new package A–>create class a’–>copy code of class a’ of projectA to this class @@)
Edit
Oh. thanks for help of Perception. Very nice and very detail to me. thanks for Baldrick help me over come this trick,too. (first time, I work like Perception say, but I don’t see project A. and don’t see nothing :-O. And I try Baldrick promise: “This way the classes in project A are available to other project.” ).
But, I think this solution has some strict:
1) projectA must be open. If not, projectB will notice error.
2) This work mean projectA and projectB are working together. But, I just like projectB inherits some useful class from projectA. (and I can change some code, and this work will not change project A).
Easy example: projectA has class Car. projectB has class Truck. class Car has some useful sub-class like Run(). Petrol(). projectB will use Run() class and change something in Petrol().
Eclipse allows you to include a variety of targets in a projects classpath, including other projects. To modify your
Project B'sclasspath, right click on it and selectProperties, thenJava Build Path->Projects. Click add and select yourProject A. When done, click ok to exit and Eclipse will do a rebuild.This is how you include one project in another project’s classpath – please, please dont copy the classes the way you are doing now, this leads to a maintenance nightmare. See screenshot below for a visual: