Eclipse does not show src file
Asked Answered
F

8

11

I have three different projects in my eclipse and yesterday src file became unvisible in one of the projects. Two days ago it was ok and I have no idea how this happened. I can not see src file in project explorer or package explorer.

Project Explorer :

Project Explorer

However, if I look with navigator I can see all files in the directories.

Navigator :

Navigator

I use Eclipse Indigo SR2 and IBM Rational ClearCase for first two project. The other is my local test project.

Do anybody know how can I get back to src file into the project explorer?

Thanks.

Flowery answered 12/8, 2012 at 7:12 Comment(2)
firstly src is not file its folder, which contains all of your packages and source files..Lamentable
check whether you can see it in package explorer.Circumscribe
H
6

Check your Java build path to make sure the src is present. Right click the project and select Build Path -> Configure Build Path. If the src directory is not present in the build path, it will not show up under the Java area as you have shown, but it will be present in the Navigator.

Heikeheil answered 12/8, 2012 at 7:17 Comment(0)
R
16

Try to right-click on the project and click on refresh.

Riancho answered 12/8, 2012 at 7:15 Comment(5)
-1 the src folder is present in the navigator, so refresh is not applicable.Heikeheil
@FrancisUpton : sometimes we need to refresh workspace. I agree with Jeshwanth because I had similar problem before. Whenever I created new class, src folder was hidden. When I refresh, I got it back.Circumscribe
What refresh does is sync the workspace with the underlying file system. The fact that the folder is present in the Navigator indicates the folder is in sync with the file system, so refresh is not applicable in this case. See my answer for more details.Heikeheil
I refreshed at least 100 times a day but nothing changedFlowery
Worked for me in C++ project in Luna. Project Explorer was out of sync with underlying file system. Refresh fixed.Fulguration
A
8

I had the same problem today, it is because i switch to wrong view model.I suggest you to switch the project explorer to Package Explorer.

Angell answered 6/11, 2016 at 14:32 Comment(0)
H
6

Check your Java build path to make sure the src is present. Right click the project and select Build Path -> Configure Build Path. If the src directory is not present in the build path, it will not show up under the Java area as you have shown, but it will be present in the Navigator.

Heikeheil answered 12/8, 2012 at 7:17 Comment(0)
C
1

I had the same problem in Neon - src folder had disappeared. One sub-directory in the src folder would show up but no other sub-dir and not the parent src file itself. No matter what I did in the buildpath configuration only the one sub-dir would show up. It looked like some kind of corruption in the settings. None of the above solutions worked for me, including deleting the project and all files, and then re-checking it out.

What did work was switching to an old workspace, importing a project and then switching back to the workspace with the issue. Magically, the project with the problem was again responding to my changes in the buildpath configuration. I'm not sure if I had to do the interim step of importing fromt he old workspace or not - possibly just switching back and forth would have worked but not sure.

Cleghorn answered 10/10, 2016 at 19:41 Comment(0)
E
0

Try removing (deleting) the project without removing the files (there is a checkbox that allows you to keep the project files).

Then re-import the project. Not sure if this will solve your problem, but I was facing the same issue and delete->re-import resolved it for me.

Equivalence answered 18/7, 2014 at 12:35 Comment(0)
W
0

I had this problem today, and the issue was that the "src" folder was not correct in the "Source" tab of "Configure Build Path" window. It was there but the path was wrong, so it had a red X. Deleting that entry and re-adding the "src" path (from the project) resulted in putting the "src" folder back into the packages hierarchy.

In my case, this happened because of sharing the workspace between user accounts, the paths to the workspace and the folder beneath were not the same. One user accessed the workspaces locally, the other as a mapped drive, etc.

Fixing this and then standardizing the path to be identical for all who access sit, resolved the underlying problem that caused this issue to surface.

Wahl answered 31/5, 2016 at 15:4 Comment(0)
C
0

solved (in Eclipse for me as simple) as

  1. remove src from Java Build Path -> Source

    (how it got there is a blunder, I might have done that myself)

  2. add src/main/java

Thx

Citizenship answered 14/8, 2024 at 13:41 Comment(0)
S
-3

Restart your eclipse work space.

Also change open perspective in eclipse.

Shuman answered 12/8, 2012 at 7:16 Comment(2)
-1 the src is present in the navigator so it's not likely workspace damage.Heikeheil
I delete whole my workspace and eclipse. Then I reinstall eclipse and import projects. After that, I try with 4 different perspective and no changes..Flowery

© 2022 - 2025 — McMap. All rights reserved.