转自:http://blog.csdn.net/fireson/article/details/6688516
现象:运行RCP application 时有exception,但编译无错误
Exception in thread "Thread-7" java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
at org.geonames.WebService.search(WebService.java:783)
at geo.GeocoderGeonames$SearchThread.run(GeocoderGeonames.java:119)
Caused by: java.lang.ClassNotFoundException: org.jdom.input.SAXBuilder
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 2 more
原因:RCP运行时加载的jar 和 外边文件,不以project configuration里面的设置为准,而是以MANIFEST.MF的配置为准。
解决:在Plug-in editor的Dependencies Tab中的Required Plug-ins 加入相对应的Plug-in ,或者是在Plug-in editor的Runtime Tab中Classpath中加入external jar