I’m trying to start equinox and one bundle in an IDE
(but not Eclipse, where I know the support is built in) using the following
code:
public class StartEquinox {
public static void main(String[] args) {
try {
BundleContext bc = EclipseStarter.startup(new String[]{"-console"},
null);
InputStream is = new
FileInputStream("./myfirstbundle/myfirstbundle.jar");
bc.installBundle("myfirstbundle ", is).start();
} catch
(Exception e) {
e.printStackTrace();
}
}
}
What I get is a stack trace:
org.osgi.framework.BundleException: The activator
com.stentra.myfirstbundle.Activator for bundle myfirstbundle is invalid
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:141)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:962)
…
Caused by: java.lang.NoClassDefFoundError:
org/osgi/framework/BundleActivator
Using java –jar <equinox.jar> and
intalling stuff manually works fine.
So presumably there is some classloader type issues here. Is
there any easy way round this?
Thanks in advance.
Richard Colvin