Fixing Problems in Eclipse

I really love eclipse. Nevertheless, it seems to cause problems fairly often, and so I decided to keep a log of each of the things that I fix.


Workspace is in use or cannot be created

There are three things that I found that cause this:

  1. You have another Eclipse instance accessing the same workspace at the same time
  2. An unclean shutdown left stale file locks
  3. You are using NFS and the locking daemon isn’t working properly

Situation 1 is of course the easiest to solve; just close the other version of eclipse.
Situation 2 requires you to delete the .metadata/.lock file from the workspace you’re trying to open.
Situation 3 may be resolved by passing the following argument to the JVM:

 -Dosgi.locking=none

For example:

./eclispe -vmargs  -Dosgi.locking=none  -Xms512m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m

Note the -vmargs argument, which marks the start of the JVM arguments.

SVN Doesn’t Work with JavaHL

If you’re using Ubuntu, add the following line to eclipse.ini:

-Djava.library.path=/usr/lib/jni

For example, my eclipse.ini looks like this:

-showsplash
org.eclipse.platform
-framework
plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Djava.library.path=/usr/lib/jni
-Xms40m
-Xmx256m
-XX:MaxPermSize=256m

One Response to “Fixing Problems in Eclipse”

  1. Greg Says:

    Thanks for the tip! I was having this problem when trying to open a workspace under OS X on a disk that is shared via AFP (rather than NFS). The locking daemon (#3 above) wasn’t working. So here’s my tip for you: if you want to open a shared Eclipse workspace under OS X, go to the Eclipse application, right-click and select Show Package Contents. From there, open Contents > MacOS, then add -Dosgi.locking=none to the file eclipse.ini. Voila, now you can open an Eclipse project across the network.

Leave a Reply