Eclipse: Workspace in use or cannot be created
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.
July 29th, 2011 at 5:45 am
Awesome! I was having this problem for a similar reason and your solution worked perfectly! Thanks for sharing the result of all your research on this!
Thanks again.
January 16th, 2012 at 9:05 am
Yeah! Thank you! I just solved a similar problem with your fix.
March 14th, 2012 at 1:02 pm
Hi,
thanks for this tip. It worked for me the first time I ran into this problem. I turned off my computer and when I turned it on again I ran into the same issue:(
Any ideas?
March 14th, 2012 at 1:08 pm
actually, reading a little bit more I found a way around it (at least for now, let’s see the next time I reboot the machine):
run eclipse as root!
http://stackoverflow.com/questions/7465793/eclipse-workspace-in-use-or-cannot-be-created-chose-a-different-one
March 30th, 2012 at 12:07 pm
@Laura: Sorry, I’m not sure. But I would suggest making sure the setting persisted after your reboot [-Dosgi.locking=java.io in the eclipse.ini file].
March 30th, 2012 at 1:14 pm
Thank you! this tip saved me a ton of headache after eclipse locked up following a forced computer restart.
August 12th, 2013 at 4:47 pm
The above solution works like a charm. It’s just that this little addition would help it make total sense:
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.
September 9th, 2013 at 2:30 pm
YES, this worked, thank you!