mosawi
mosawi

Reputation: 1323

Eclipse showing java project src folder view as all packages and subpackages

Not sure how to really ask this question since I don't know what everything is called but I'll try to do the best I can.

So as I was cleaning up my classes. I right clicked my project and selected refresh. Then all of a sudden my project view changed, the src folder shows everything as packages and '.' separated subpackages. And all my code package declarations seems now to be undiscoverable.

I've attached a photo, hopefully you can petter understand this...How can I fix this to have the correct directory view/structure.

Edit:

Here is what I have linked to my JAVA build path

I don't understand what is happening? How can all of a sudden my project screw up like it has? Any help will be much appreciated

Upvotes: 8

Views: 16405

Answers (6)

simnani
simnani

Reputation: 1

You can set/update package structure from Build Path 1

2

Upvotes: 0

61433n
61433n

Reputation: 11

The following worked for me:
Right Click on src (which is shown like empty package in my project) -> Build Path -> Use As Source Folder

Upvotes: 0

mosawi
mosawi

Reputation: 1323

I was able to fix this by maven>update project, then just refresh...

Upvotes: 7

greg-449
greg-449

Reputation: 111142

Look at the 'Java Build Path' in the project 'Properties' and check that you have the correct 'Source' folders. It looks like you may have just 'src' as a source folder when you should have 'src/main/java', 'src/test/java'...

Upvotes: 12

solar
solar

Reputation: 1364

In addition to the previous answer you also may use empty package filter: At the top-right of the Package Explorer view, there's a downward-pointing triangle. If you hover your mouse pointer over it you'll see View Menu.

Click the View Menu, select Filters, put a check next to Empty Packages, then click OK. Same way you could tune other options for Package explorer such as file types to show etc.

Upvotes: 4

Dici
Dici

Reputation: 25950

Well, it seems pretty clear that your hierarchy does not match the name of your package, so just fix your hierarchy. It will be easier if you switch to the hierarchical view of the packages. To do so, go to Package explorer, View menu (arrow icon pointing to the bottom), Package presentation, Hierarchical.

Upvotes: 0

Related Questions