开发者

Why does my Eclipse plugin startup fine in one workspace, but not in another?

I have created a plugin for Eclipse and exported it as a JAR file. I put it in the plugins directory of my Eclipse RCP distribution. I then open Eclipse and the plugin functions as expected. I go to my other computer and put the JAR in the plugins directory of the Eclipse RCP distribution and then open Eclipse.

I get messages such as the following in my Error Log:

  • Problems encountered starting up plug-in: "org.osgi.framework.BundleException: Exception in myplugin.Activator.start() of bundle MyPlugin"
  • Unable to execute early startup code for an extension
  • Bad extension specification
  • startup class must implement org.eclipse.ui.IStartup

Some of those messages confuse me th开发者_如何学运维ough, because this is what my Activator class looks like:

public class Activator extends AbstractUIPlugin implements IStartup {...

It clearly implements IStartup, for instance.

Does anyone have any ideas of what is going on here or at least what direction I should head in to fix this issue?

EDIT

I have now created a new class called StartupClass.java:

package myplugin;

import org.eclipse.ui.IStartup;

public class StartupClass implements IStartup {

@Override
public void earlyStartup() 
{

}
}

I then changed my plugin.xml to look like this:

<extension point="org.eclipse.ui.startup">
<startup class="myplugin.StartupClass" />
</extension>

Which results in similar errors such as:

  • An error occurred while automatically activating bundle MyPlugin
  • Plug-in MyPlugin was unable to load class myplugin.StartupClass
  • Unable to execute early startup code for an extension


Do you have the org.eclipse.runtime.compatibilty plugin in one workspace but not the other?

The way you're doing this is deprecated, you should have a separate "startup" class and specify that as the class attribute of your <startup> element.

From the Eclipse docs on the startup extension point:

Do not specify the plug-in class as the value of the class attribute, or it will be instantiated twice (once by regular plug-in activation, and once by this mechanism). If the extension does not provide a class as an attribute on the startup element, the plug-in's activator (plug-in class) must implement org.eclipse.ui.IStartup.

Note that this form is deprecated and should no longer be used. Its functioning relies on the availability of the org.eclipse.core.runtime.compatibility plug-in and the org.eclipse.core.runtime.compatibility.registry fragment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜