我想把自己寫的程序實現為Eclipse插件,
當運行選擇run->org.eclipse.ui.ide.workbench是可以正常運行
但當我我把項目打包放到了plugins下包名字為helloworld.jar
運行的時候就遇到錯誤了,請高手指點,這個問題該怎么解決。謝謝
下面是XML文件
*********************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
id="com.yangfei.examples.helloworld"
name="Hello World Plugin"
version="1.0.0">
<requires>
<import plugin="org.eclipse.ui" />
</requires>
<runtime>
<library name="helloworld.jar" />
</runtime>
<extension point="org.eclipse.ui.views">
<category id="com.yangfei.examples.helloworld.hello" name="Hello" />
<view id="com.yangfei.examples.helloworld.HelloWorldView"
name="Hello Greetings"
category="com.yangfei.examples.helloworld.hello"
class="com.yangfei.examples.helloworld.HelloWorldView" />
</extension>
</plugin>
*********************************************************************
##############################################################
這斷HelloWorldView.java的代碼
package com.yangfei.examples.helloworld;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.ui.part.ViewPart;
public class HelloWorldView extends ViewPart {
Label label;
public HelloWorldView() {
}
public void createPartControl(Composite parent) {
label = new Label(parent, SWT.WRAP);
label.setText("Hello World");
}
public void setFocus() {
}
}
##############################################################
windows->show View->other->Hello->Hello Greetings 時就遇到了錯誤
錯誤信息如下:
java.lang.ClassNotFoundException: com.yangfei.examples.helloworld.HelloWorldView
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:403)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:275)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1259)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:152)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:142)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:129)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:48)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:240)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:236)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:99)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:267)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:180)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:283)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:512)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:391)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1102)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:591)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:528)
at org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:485)
at org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:230)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:813)
at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2165)
at org.eclipse.ui.internal.WorkbenchWindow$5.run(WorkbenchWindow.java:2356)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2338)
at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1861)
at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java:2566)
at org.eclipse.ui.internal.Workbench.access$14(Workbench.java:2515)
at org.eclipse.ui.internal.Workbench$19.run(Workbench.java:1514)
at org.eclipse.ui.internal.Workbench$16.run(Workbench.java:1263)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:346)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:291)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:447)
at org.eclipse.ui.internal.Workbench.runStartupWithProgress(Workbench.java:1258)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1512)
at org.eclipse.ui.internal.Workbench.access$12(Workbench.java:1491)
at org.eclipse.ui.internal.Workbench$17.run(Workbench.java:1374)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run(Platform.java:783)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1318)
at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:183)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:700)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1034)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1636)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
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.core.launcher.Main.invokeFramework(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)