that were shone when I got tempered!

How to recover eclipse?

leave a comment »

Follow this if your eclipse got crashed.

  • Delete the .lock file in the workspace/.metadata folder and restart the IDE
  • If this is not working delete the .snap file in the workspace/.metadata/.plugins/org.eclipse.core.resources and restart the IDE
  • If this is also not working
    • cd .metadata/.plugins
    • mv org.eclipse.core.resources org.eclipse.core.resources.bak
    • Start eclipse. (It should show an error message or an empty workspace because no project is found.)
    • Close all open editors tabs.
    • Exit eclipse.
    • rm -rf org.eclipse.core.resources (Delete the newly created directory.)
    • mv org.eclipse.core.resources.bak/ org.eclipse.core.resources (Restore the original directory.)
    • Start eclipse and start working.

More about the .lock

Eclipse comes with a locking mechanism that is on a ‘per workspace’ basis to ensure that there is no data corruption; only one Eclipse instance can operate on a particular workspace at a time, and as such each workspace is locked while it is open for business.

So… how do you break in to Eclipse when you leave your keys on the dresser? Well, it’s actually quite simple. When a workspace is brought up by a particular instance, that Eclipse instance will produce a ‘ .lock ‘ file and store it in a special folder for that workspace. Each workspace captures unique settings in a ‘.metadata ‘ folder. As a side note, this is also where the unique Eclipse workspace settings are stored.

If you are on Eclipse 2.1, to get back in to Eclipse so you can do your needed work, simply delete your ‘ [Workspace Home]/.metadata/.lock ‘ file.

As of Eclipse 3.0, however, the existence of the file is no longer the relevant state. The good news is that reserved file locks should happen a lot less now due to the nature of the locking mechanism. The bad news is it is somewhat less apparent how to unlock the environment if something does go wrong. Eclipse 3.0 will attempt to use an operating system file lock on the .lock file (file lock on the lock file, that’s a mouthful). If, for some reason, Eclipse cannot lock this file, in 99% of the cases simply restarting your OS will clear up any file locks or file handles that may be in place. It also doesn’t hurt to delete the file, but chances are if you can delete the file, Eclipse could lock it – so this probably isn’t a plausible solution.

The remaining 1% of the cases are more than likely caused because you are fiddling with folder permissions, and Eclipse can’t write to the .metadata folder. Bad user!

More About .snap file

It looks like your eclipse platform is crashing quite often. Because otherwise, the snapshot files should not be there while the platform is not running. As the referenced page in roe’s comment explains, they are just needed for crash recovery and are deleted during normal shutdown of the platform. Deleting them will make eclipse think, that no crash occurred but then it can’t recover and you may have to refresh/rebuild your workspace (which may take the same time).

I’d not delete those files except eclipse won’t recover from a crash. Have a look at the eclipse workspace and platform log files if you have troubles with some plugins and fight the problem from this side (updating plugins or sending error reports) instead of deleting those files.


Written by Namal Fernando

November 6, 2013 at 4:25 pm

Posted in Eclipse

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Ruth's Reflections

Contemplations from quakey quirky Christchurch

TED Blog

The TED Blog shares interesting news about TED, TED Talks video, the TED Prize and more.


Learn and discover simple things

Meihta Dwiguna Saputra's Knowledge Base

~In learning you will teach and in teaching you will (re)learn~

The Java Blog

Thoughts, tips and tricks about the Java programming language


that were shone when I got tempered!

%d bloggers like this: