Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to Start a bundle programatically
How to Start a bundle programatically [message #509026] Thu, 21 January 2010 08:39
Cristina  is currently offline Cristina Friend
Messages: 8
Registered: January 2010
Junior Member

I have a plug-in implementing an osgi "server" and another one implementing a view of eclipse. Using the view, I want to control went to start and stop the server.

To do this, I need to be able to start and stop the bundle programatically whenever I need. What is the best way to do so? Or more important... is that possible?

I've try it by implementing the following code in the main method of a Java class.

String[] equinoxArgs = {"-console","1235","-noExit"};
BundleContext context = EclipseStarter.startup(equinoxArgs, null);
Bundle bundle= context.installBundle(

If I run the Java class as an Eclipse Application it seems to work fine. The problem is when I try to run the plugin which is calling the class...

I run the plugin as an Eclipse Application to see how it works, and everything seems to be fine until I press the Start buttom, when I get the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/adaptor/EclipseStarter
at eu.sofia.m3.osgi.sib.deploy.Start.main(
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 1 more

Any clue about how to solve this problem? Or any alternative to start the bundle programatically?

Any help will be really appreciated.

Thanks in advance.

[Updated on: Thu, 21 January 2010 08:42]

Report message to a moderator

Previous Topic:OSGi - NullPointerException in ContextFinder
Next Topic:Where's the best place to put code that shutdowns Ehcache CacheManager ?
Goto Forum:

Current Time: Thu May 24 02:32:56 GMT 2018

Powered by FUDForum. Page generated in 0.01211 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top