Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Source Folders vs Packages

In Eclipse, within a project, when and why is it advantageous to create multiple source folders, instead of having multiple packages within the default source folder (src). How do source folders behave differently from packages?

like image 218
Stephane Bersier Avatar asked Mar 10 '26 23:03

Stephane Bersier


1 Answers

Source folders are useful to build several artefacts (jar files, for example) from a given project. The most common usage is to have a source folder for the classes of an application, and another one for the classes of the tests of the application.

Packages and source folders are an orthogonal notion. The package of a class is what is declared after the package keyword in the class, whatever its source folder is. Source folder are simply a way to segregate source files inside your project.

like image 171
JB Nizet Avatar answered Mar 12 '26 16:03

JB Nizet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!