How do I prevent Eclipse from hanging on startup?

I am using Eclipse 3.3 ("Europa"). Periodically, Eclipse takes an inordinately long time (perhaps forever) to start up. The only thing I can see in the Eclipse log is:

    !ENTRY org.eclipse.core.resources 2 10035 2008-10-16 09:47:34.801
    !MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

Googling reveals someone's suggestion that I remove the folder:

workspace\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes

This does not appear to have helped.

Short of starting with a new workspace (something which I am not keen to do, as it takes me hours to set up all my projects again properly), is there a way to make Eclipse start up properly?


Solution 1:

This may not be an exact solution for your issue, but in my case, I tracked the files that Eclipse was polling against with SysInternals Procmon, and found that Eclipse was constantly polling a fairly large snapshot file for one of my projects. Removed that, and everything started up fine (albeit with the workspace in the state it was at the previous launch).

The file removed was:

<workspace>\.metadata\.plugins\org.eclipse.core.resources\.projects\<project>\.markers.snap

Solution 2:

try:

  1. cd to <workspace>\.metadata\.plugins\org.eclipse.core.resources
  2. remove the file *.snap (or .markers in Indigo)

Solution 3:

In my case (Juno) I had to do this:

find $WORKSPACE_DIR/.metadata/.plugins/org.eclipse.core.resources/.projects \
-name .indexes -exec rm -fr {} \;

That did the trick.

Initially I thought it was a problem with Mylyn (I experienced these freezes after I started using its generic web connector), but the problem appeared even after uninstalling the connector, and even deleting the .mylyn directories.

Edit: I also managed to restart eclipse by deleting just one file:

rm $WORKSPACE_DIR/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi

That worked fine, without any indexes involved. Only the workbech, which I personally don't mind that much.

Solution 4:

You can try to start Eclipse first with the -clean option.

On Windows you can add the -clean option to your shortcut for eclipse. On Linux you can simply add it when starting Eclipse from the command line.