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.



|------------>
| From:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"林恺" <[EMAIL PROTECTED]>                                                     
                                                                  |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Equinox development mailing list" <equinox-dev@eclipse.org>                 
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |2008-09-04 09:32                                                             
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [equinox-dev] Starting equinox framework in program                      
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Sent by:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |[EMAIL PROTECTED]                                                            
                                                       |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|





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 <[EMAIL PROTECTED]>
  I need to better understand your requirements:

  Are you simply trying to get a valid BundleContext? If so you get access
  to your bundle's BundleContext when you bundle is activated. The
  BundleContext is passed to you in your
  BundleActivator.start(BundleContext) method.

  >From your description it does not sound like you want to actually start
  another instance of the Equinox when your bundle is already running in an
  instance of the Framework. Instead you simply need to get access to your
  bundle's BundleContext so you can interact with the Framework.

  HTH.

  Tom



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






<<inline: graycol.gif>>

<<inline: ecblank.gif>>

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

Reply via email to