tags:

views:

102

answers:

2

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?

+1  A: 

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 run into Eclipse synchronization issues a lot, but I put it down to a combination of flakey plugins and doing builds from the command line. Either F5 or Project>Clean usually works for me.)

Stephen C
@Stephen C I am absolutely puzzled, but it seems that I found the root of the problem. I used a few shared libraries from a shared folder. It became unreachable for some time. I simply added the same files from the local path. those links weren't deleted from build path though. Such a mess makes Eclipse behave in a way I described. I'm not sure my problem is resolved, but at least I see that now all erroneous files are marked red in Project Explorer.
EugeneP
*after I deleted the unreachable links to the shared folder from a build path of the project*
EugeneP
Hmm ... yes ... that would do it too. Eclipse would be unable to refresh the cached copies of those files. And they were probably on the build path ahead of the local copies that you made.
Stephen C
+1  A: 

Is Build automicly on ? (Menu > Project > Build automaticly )

tjin
yes, thank you. it was on.
EugeneP