Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse does not refresh project files in package explorer view

Tags:

java

eclipse

Today I see a strange behaviour of Eclipse 3.5.2 for the first time in 3 months.

First, when I run a main function, it runs a previously compiled version. Let's say I press Ctrl+F11 in the window with an open java class and existing main function. Usually it rebuilds the class and runs a new version. Today even if there was a compile mistake, it would run fine. So I guess it does not recompile the class.

Next, more strangely, if I intentionally make a mistake in the code and Eclipse underlines those lines in red, still the project Explorer does not mark them as containing errors. They remain of grey color if there were not any errors.

First I did not know how to solve this problem. I tried to reopen the project, restart Eclipse and finally reboot the OS. After the tenth attempt, after rebooting, Eclipse said that all project's files are "OUT OF SYNC with the file system". When I pressed "Refresh" - F5 on a project's header name in Project Explorer it finally marked all the files with errors as containing errors and running the main function gave the desired result.

An hour of my work passed and this happened again , with the other project. All the same. No marking of files as red, running no matter what old version of class with no compile errors.

And since Eclipse does not tell that files are out of sync, simply pressing F5 on a project cannot help.

What can you suggest?

like image 919
EugeneP Avatar asked May 12 '10 10:05

EugeneP


1 Answers

When you select a project in the Project Explorer view and press F5, Eclipse should traverse the entire directory tree for the project checking that all files and directories all in sync. It does for me ...

The only thing I can think of that would cause this not to work is if you have file system timestamp anomalies. For example, if a file in the file system is updated but the file's last-modified shows that it was updated in the past. This kind of thing can happen if your machine's system clock is moved backwards or forwards at an inconvenient time. If you think this might have happened, try closing all projects, restarting Eclipse and doing another F5 refresh.

(I used to run into Eclipse synchronization issues a lot, but I put that down to a combination of flakey plugins and doing builds from the command line. Either F5 or Project>Clean usually works for me.)


It is also worth checking that you haven't turned off "Build automatically"; see https://stackoverflow.com/a/2818290/139985. This is not a "refresh" problem, but it would be easy to confuse it with one.

like image 159
Stephen C Avatar answered Nov 09 '22 23:11

Stephen C