I was trying to build an OSGi runtime monitor to control and monitor the equinox framework. This OSGi runtime monitor is an Eclipse plugin, and is something just like the OSGi console when we running equinox application in eclipse through OSGi Framework launch configuration, and we can list bundle and service information, start and stop bundle and so on.
The problem is I can find the way to start equinox framework programly and get the BundleContext. I have search on google, and get this method:
BundleContext context = EclipseStarter.startup(new String[] { "-console", "-clean" }, null);
This can work when I put it in a Java Application, but when I put it in an Eclipse Plugin, I got this error message:
java.lang.IllegalStateException: Platform already running
The reason for this may be : We have started the Eclipse platform, and then we use EclipseStarter to start our equinox framework, we get this error.
Is there a way I can start equinox framework in program and get the BundleContext? When we running equinox application in eclipse through OSGi Framework launch configuration, It seems the way. Does anyone can give me some help?
Thanks.
Link