I have a demo project-named A having a class Class AA. and I have another demo project-named B having a class Class BB. My question is how can I import ClassBB in class AA??????
Asked
Active
Viewed 2.3k times
4
-
check this thread if you are working with eclipse: http://stackoverflow.com/questions/3487585/import-from-another-java-project-in-eclipse – Kyriakos Sep 14 '12 at 13:54
3 Answers
11
What you have to do is to add project A to project B's build path. Check this thread if you are working with eclipse: import from another java project in eclipse
right click on project b's folder in eclipse --> properties --> build path --> projects --> add.
-
actually the question was about importing class, not whole project. In my case I have two projects with same class names, and I want to import only one of the classes. I'm worried about the name conflicts if I import whole project... is it possible to do it with only one helper class? – kiedysktos Sep 03 '15 at 12:33
1
Add Project B in A's build Path. If you are using Eclipse. Right Click on Project->Java Build Paht->Projects->Add

Amit Deshpande
- 19,001
- 4
- 46
- 72
0
You have to define a dependency from you project A to project B.
In eclipse, make a right-click on project A and select "Propeties". Then, in "Java build Path", choose the "Project" tab. Click on the "Add" button and select project B. Validate, and you'll be able to import class BB in class AA

DayS
- 1,561
- 11
- 15