Skip to main content
Jump to: navigation, search

FAQ What causes my plug-in to build but not to load in a runtime workbench?

Revision as of 00:06, 18 February 2010 by (Talk | contribs) (updated the information on troubleshooting runtime NoClassDefFoundErrors)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Runtime problems are usually indicated by a java.lang.NoClassDefFoundError when the plug-in is started.

To troubleshoot runtime issues, it is helpful to understand a little bit more about Eclipse classpaths. Eclipse distinguishes between a compile-time classpath and a runtime classpath. The compile-time classpath provides the Eclipse development workbench with all necessary information for compiling a plug-in and is declared in the plug-in project's .classpath file. The runtime classpath, on the other hand, tells OSGi and the Eclipse runtime workbench which plug-ins and JARs are necessary to execute the plug-in. The runtime classpath is determined by the MANIFEST.MF file. Typically, the compile-time classpath includes most runtime dependencies, and the recommended way to incorporate these dependencies also at compile-time is to use the Plug-in Dependencies classpath container. This container will be automatically populated with the dependencies listed in the MANIFEST.MF file.

java.lang.NoClassDefFoundErrors are runtime problems, so editing the .classpath file will usually not solve these problems. Instead, check these files:

  • the MANIFEST.MF file
  • the file
  • the launch configuration that you used to start the plug-in

In most cases, the MANIFEST.MF is the culprit. The most common problems with the manifest are:

  • missing "." entry in the Bundle-ClassPath, especially when additional JARs were added to the plug-in's runtime classpath
  • missing Export-Package in the manifest of required plug-ins

Next in line of the trouble-makers is the file. Most developers consider the file a compile-time file, because it mainly tells the PDE build how to package a deployable plug-in. However, the file is also used by PDE to create a runtime workbench that (as closely as possible) replicates the behavior that one would see if the packaged plug-in were to be deployed into a primary workbench. This "black magic" behind the scenes may preclude certain JARs or packages from being visible at runtime if the file is incorrect or incomplete. If you are 100% sure that your manifest is absolutely correct then you should check for warning markers in the file.

Finally, if your plug-in (or another plug-in that is required by your plug-in) is not enabled as part of your launch configuration its classes obviously cannot be loaded at runtime. If your launch configuration uses the "plug-ins selected below only" option, make sure that all required plug-ins are indeed selected in the list.

See Also:




This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top