Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NoClassDefFoundError:org/apache/bcel/classfile/ClassParser_Java_Classnotfoundexception - Fatal编程技术网

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

java.lang.NoClassDefFoundError:org/apache/bcel/classfile/ClassParser,java,classnotfoundexception,Java,Classnotfoundexception,当我执行以下命令时 ClassParser parser = new ClassParser("E:\temp\TestCasing.class"); 我得到以下例外: java.lang.NoClassDefFoundError: org/apache/bcel/classfile/ClassParser at in.ac.iiitb.krishna.classinformationretrieval.ClassInformationRetrievalView$3.widgetSel

当我执行以下命令时

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插件项目中不起作用。

在运行时,您需要在类路径中使用这个jar


只需将jar放在类路径中,如果放在构建路径中,它将仅在构建时可用