Eclipse source out of sync with file system

2020-02-20 06:45发布

I inherited a java project and don't have much experience with Eclipse. In the package explorer I can see the outline of the project with all the classes but when I try to edit any of them it says the source code is not found. When I look the source code is where it seems it is supposed to be. I am assuming that in pulling the code out of source control the path must have changed from the original. Is there an easy way to tell the IDE to just connect a code file to a class?

What's really weird is that 'some' of the files in the very same directory are found while others are not. Can't say I think very highly of this IDE so far.

标签: java eclipse
10条回答
老娘就宠你
2楼-- · 2020-02-20 07:14
  1. Right click on the project in the Package Explorer view and select Refresh. If it is not working,
  2. Clean the project... project menu -> clean... and refresh
查看更多
孤傲高冷的网名
3楼-- · 2020-02-20 07:20

If refresh and clean doesn't work, it might work to just simply just run your code. For me it did the trick. After many refresh and cleaning/ building didn't work.

查看更多
Emotional °昔
4楼-- · 2020-02-20 07:21

You can right click on the project name and click refresh. And just to be sure, you can select the package name and right click 'Refresh' too.

查看更多
我想做一个坏孩纸
5楼-- · 2020-02-20 07:25

Click on the project, then press F5 to refresh the file. It should be fine.

查看更多
霸刀☆藐视天下
6楼-- · 2020-02-20 07:26

You can have Eclipse do that automatically for you.

Using the latest version, go to Window -> Preferences.

Select General -> Workspace and from there make sure the first and second option are checked:

  • Build automatically
  • Refresh using native hooks or polling

Eclipse Workspace preferences

This is very useful especially if you use Dropbox or something similar (wuala etc) :)

查看更多
forever°为你锁心
7楼-- · 2020-02-20 07:30

Right click on the project in the Package Explorer view and select Refresh.

查看更多
登录 后发表回答