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.

8 Responses to “Eclipse: Workspace in use or cannot be created”

  1. John Says:

    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.

  2. André Says:

    Yeah! Thank you! I just solved a similar problem with your fix.

  3. Laura Says:

    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?

  4. Laura Says:

    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

  5. sconzof Says:

    @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].

  6. Madhukar Says:

    Thank you! this tip saved me a ton of headache after eclipse locked up following a forced computer restart.

  7. I.H. Says:

    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.

  8. Chris Says:

    YES, this worked, thank you!

Leave a Reply