What is the best way to reuse classes from another Java project in Eclipse?
Asked Answered
D

1

10

I have multiple Java projects in Eclipse. I would like to reuse some classes in my new project from my old project. What is the best way to do that in Eclipse?

I.e. is it possible to add another "project folder" to the build-path for my new project?

Diastasis answered 2/6, 2010 at 20:37 Comment(0)
M
13

Yes, in the build path dialog (Build Path > Configure Build Path...), go to the Projects tab, and add the project dependencies.

On the included project, you can use the Order and Export tab to select, which parts of your source folders and libraries to export to dependent projects.

Messing answered 2/6, 2010 at 20:41 Comment(2)
After I added a project, I don't have any options under Order and Export tab, I can only select the whole project. What did you mean by select which part of your source folders to export?Rudimentary
@Danijel: Use "New > Source Folder" first. Then you can select the individual folders to export, as described above.Messing

© 2022 - 2024 — McMap. All rights reserved.