Issue
When I create a java project in eclipse it automatically creates a default package in the src file(which I do not intend to) and when I try to create a package for eg. com.utility.org it goes ahead and creates extra packages named com, com.utility, com.utility.org
Snapshot of the error I am facing in creating packages
Solution
You can hide (default package)
by checking the Empty parent packages filter (Package Explorer's kebab menu > Filters...).
In Java, packages match the directory architecture of the source folder, so creating a com.utility.org
package will create the com/utility/org
nested folders. Hence com
and com.utility
are not "extra" packages but actual packages corresponding to the com/
and com/utility
folders. (default package)
corresponds to the source folder itself.
Since empty, com
and com.utility
should be hidden by the filter. Alternatively you can also ask the Explorer to group nested packages as a tree (Package Explorer's kebab menu > Package Presentation > Hierarchical):
Answered By - Emmanuel Chebbi