Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 730
Jonas Avatar asked Jun 02 '10 20:06

Jonas


People also ask

How do I link two classes in Eclipse?

Eclipse can't do that automatically, You will have to go to one class, press control+a then control+c then go to the other class and press control+v.


1 Answers

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.

like image 65
Chris Lercher Avatar answered Oct 17 '22 23:10

Chris Lercher