[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Starting equinox framework in program

As you said your application is an Eclipse plug-in, I assume it's RCP application whether it has UI or not. Equiiox(OSGi) framework would be started firstly when your application launch, then your plug-in can obtain BundleContext in its bundle activator. Don't need explicitly call EclipseStarter.startup to launch OSGi framework.


Inactive hide details for "林恺" ---2008-09-04 09:32:23---Tom, Thanks for your reply. I sorry that I did not express my quest"林恺" ---2008-09-04 09:32:23---Tom, Thanks for your reply. I sorry that I did not express my question clearly.


From:

"林恺" <bmlinkai@xxxxxxxxx>

To:

"Equinox development mailing list" <equinox-dev@xxxxxxxxxxx>

Date:

2008-09-04 09:32

Subject:

Re: [equinox-dev] Starting equinox framework in program

Sent by:

equinox-dev-bounces@xxxxxxxxxxx




Tom,
Thanks for your reply. I sorry that I did not express my question clearly.
I was finding a way to start an Equinox framework through Java application. It looks like: I have a set of bundles in a folder which construct an application. In a normal way when I want to start the framework, I just need to click the launcher or type a command line in the console. What I need is to write a program, this program may NOT be a bundle, and start the Equinox framework and install all the bundles in the folder but no need to click or type something. I have search on google and found that EclipseStarter can do this in Java application, and I have try it. Code likes:

public static void main(String[] args) {
BundleContext context = null;
// start up OSGI framework.
context = EclipseStarter.startup(new String[] { "-console" }, null);

context.installBundle("file:////path/to/bundle.jar");
}

For my application is an ECLIIPSE PLUG-IN, when I use the same code snipe to start another Equinox framework, I got the error message that told me "framework is running". I think the reason is that Eclipse platform has already use EclipseStarter to start itself, and when you try to use EclipseStarter to start another Equinox framework, you get such error. EclipseStarter is a static utility class.
I wonder whether there is a way to fix the problem using EclipseStarter or there is another way to start Equinox framework as I need and got BundleContext like the method EclipseStarter.startup().



2008/9/3 Thomas Watson <tjwatson@xxxxxxxxxx>

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev

GIF image

GIF image