jbranchaud
jbranchaud

Reputation: 6087

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:

Some of those messages confuse me though, 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:

Upvotes: 2

Views: 4877

Answers (1)

John Flatness
John Flatness

Reputation: 33769

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.

Upvotes: 1

Related Questions