java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassParser

发布于 2024-11-26 21:19:30 字数 2973 浏览 0 评论 0原文

当我执行以下操作时,

ClassParser parser = new ClassParser("E:\temp\TestCasing.class");

出现以下异常:

java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassParser   
 at in.ac.iiitb.krishna.classinformationretrieval.ClassInformationRetrievalView$3.widgetSelected(ClassInformationRetrievalView.java:113)    
 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)   
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)    
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)  
 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)    
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)  
 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)     
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)    
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)     
 at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)     
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)    
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)     
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)    
 at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)   
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)    
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)    
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)  
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)    
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     
 at java.lang.reflect.Method.invoke(Unknown Source)     
 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)    
 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)   
 at org.eclipse.equinox.launcher.Main.run(Main.java:1410)   
 at org.eclipse.equinox.launcher.Main.main(Main.java:1386) 
Caused by: java.lang.ClassNotFoundException: org.apache.bcel.classfile.ClassParser  
 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)  
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)  
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)  
 at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)     
 at java.lang.ClassLoader.loadClass(Unknown Source)     ... 27 more

我也将 bcel-1.3.2.jar 放入构建路径中。但它仍然给了我同样的例外。 相同的代码作为独立的 java 应用程序可以正常工作,但不能在 SWT 插件项目中工作。

When I execute following

ClassParser parser = new ClassParser("E:\temp\TestCasing.class");

I get following exception:

java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassParser   
 at in.ac.iiitb.krishna.classinformationretrieval.ClassInformationRetrievalView$3.widgetSelected(ClassInformationRetrievalView.java:113)    
 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)   
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)    
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)  
 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)    
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)  
 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)     
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)    
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)     
 at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)     
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)    
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)     
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)    
 at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)   
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)    
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)    
 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)  
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)    
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     
 at java.lang.reflect.Method.invoke(Unknown Source)     
 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)    
 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)   
 at org.eclipse.equinox.launcher.Main.run(Main.java:1410)   
 at org.eclipse.equinox.launcher.Main.main(Main.java:1386) 
Caused by: java.lang.ClassNotFoundException: org.apache.bcel.classfile.ClassParser  
 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)  
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)  
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)  
 at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)     
 at java.lang.ClassLoader.loadClass(Unknown Source)     ... 27 more

I have put bcel-1.3.2.jar in the build path also. Still it is giving me the same exception.
The same code is working fine as a stand alone java application.But not working in a SWT plugin project.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

善良天后 2024-12-03 21:19:30

运行时您的类路径中需要这个 jar。

You need this jar in your classpath at runtime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文