Eclipse NoClassDefFoundError near installFont on startup
At work and at home I use Eclipse as my IDE of choice for Java development, along with Eclipse-in-disguise Aptana for web development. I’ve never had a problem with Eclipse on Windows or on my Mac, but on my Linux machine (and many of my co-workers’ machines) Eclipse tends to crash rather violently. I suspect that it isn’t Eclipse at all, but the primitive P4WSAD Perforce plugin. I don’t use Perforce at home, so that might be the difference. Anyway, what happens is that in the middle of doing something Eclipse will run out of PermGen memory, throw up some errors, and die in the least pleasant way possible. When you try to start it back up, you get something like this:
!SUBENTRY 1 org.eclipse.team.core 4 0 2007-08-20 16:58:25.979
!MESSAGE Could not instantiate provider com.perforce.team.core.PerforceTeamProvider for project SampleProject.
Exception in thread "Thread-1" java.lang.NoClassDefFoundError
at org.eclipse.ui.internal.themes.ThemeElementHelper.installFont(ThemeElementHelper.java:101)
at org.eclipse.ui.internal.themes.ThemeElementHelper.populateRegistry(ThemeElementHelper.java:57)
at org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1426)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3296)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2974)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
Further digging reveals that the culprit is definitely the Perforce plugin. To fix it, you need to go to where Eclipse is installed, and move the plugins/com.perforce.* files away. Then start Eclipse, which will start but complain about the missing plugin. Then shut down Eclipse, move the plugins back, and start up again. You’ll need to reconfigure any Perforce windows you had open, but at least Eclipse will start.
This seems to be caused by Eclipse crashing after running out of PermGen memory. To prevent future crashes, edit eclipse.ini in your Eclipse install directory. It should look something like this:
-showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m -vmargs -Xms40m -Xmx512m -XX:MaxPermSize=256m -Dosgi.bundlefile.limit=100
The -XX:MaxPermSize is especially important for preventing Eclipse crashes. The other option, –launcher.XXMaxPermSize only works in Windows.

October 11th, 2007 at 12:29 pm
I thought I was crazy when concluding the startup errors were related to the P4 plugin. Nice to see someone else has seen the same problem.
October 25th, 2007 at 3:00 pm
Thanks so much for posting this! Was going crazy trying to figure out what happened. (I didn’t realize that launcher was only for windows either so thanks for that as well!)
October 30th, 2007 at 2:21 pm
Wow! That was exactly what I needed, I thought I was going to lose another day to setting up a new workspace from scratch. Thanks a million!
November 14th, 2007 at 2:36 pm
Just wanted to add a “me too!” Thanks very much for the helpful hint. =:)
November 16th, 2007 at 9:42 am
Thank you so much, it all makes sense now.
November 21st, 2007 at 10:13 am
Thanks - I had already updated some of the memory settings in the ini file, but hadn’t realized that it was the perforce pluggin that was causing me troubles. One more reason to go to Subversion :)
December 6th, 2007 at 12:31 pm
Yeah, I was not the only one…. The fix I found was to restart eclipse with a different workspace (no perforce projects) to disable the P4WSAD plugin. Once disabled, it will start correctly with your actual workspace. Eventually you can re-enable P4WSAD at this point.
Really annoying this bug….
December 13th, 2007 at 3:28 pm
Thanks a lot.. I almost went back to 3.1.2 cos of this annoying bug
January 25th, 2008 at 3:05 am
Thanks too… who were all the people that have written elsewhere about how great the plugin is. Do they work for perforce by some chance?
January 27th, 2008 at 2:36 am
Thanks a lot!!
May 14th, 2008 at 4:56 pm
Cool… saved me the tons of time I would have spent on debugging this issue.
Thanks!