Archive for February, 2011

Eclipse: Workspace in use or cannot be created

Tuesday, February 22nd, 2011

I recently started using Eclipse on my Mac instead of my old WinXP Machine. I moved my workspace to a shared drive (smb://), but could not open my existing workspace. I received the error: “Workspace in use or cannot be created, choose a different one”.

There was no instance of eclipse accessing that workspace, but I found a .lock file workspace/.metadata/.lock. After manually removing the .lock file, I would restart Eclipse but it would still complain and re-write the .lock file back to the folder.

A local workspace worked just fine, so the problem is exclusive to using a workspace from a mounted filesystem. A quick search for NFS eclipse workspace turned up a way to alter the way file locking is done.

I edited the eclipse.ini file in Eclipse.app/Contents/MacOS, and added the following:

-Dosgi.locking=java.io

Once I added that startup option, eclipse was able to use the mounted workspace.

(edit recommended I.H. in comment below — thanks!):
On a Mac OS X system, you can find eclipse.ini by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate eclipse.ini in the MacOS folder under Contents.