[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Integrating plugin bundles in normal Java

I would recommend that you launch app A in a way that is consistent with the normal launch of eclipse. By that I mean use a configuration folder with a config.ini that is the same as if you are launching your application with the eclipse.exe. The config.ini configures a set of bundles into the framework for your application. You should be able to do something like this

        String[] equinoxArgs = { "-console", "-noExit",
              "-configuration" "/path/to/configuration",
              "-application", "myApp.Application"};
       BundleContext context = EclipseStarter.startup(equinoxArgs, null);

        Object appResult = EclipseStarter.run(null);


Inactive hide details for Tom Hsu ---10/29/2008 01:41:44 PM---Hi experts,Tom Hsu ---10/29/2008 01:41:44 PM---Hi experts,


Tom Hsu <tom.hsu@xxxxxxxxxx>




10/29/2008 01:41 PM


[equinox-dev] Integrating plugin bundles in normal Java

Hi experts,

I am new to equinox so please excuse me for some obvious/stupid
questions. However, I am still trying to wrap my head around this module

I am tasked with integrating an existing application A that is build
using bundles and equinox osgi in eclipse into another standalone Java
program B that will be traditional jar based program. I would like to
invoke the Equinox OSGi system to load these bundles/packages in the
standalone Java program through code and execute the main method of the
app A through program B.

My setup is as follows:
/plugins/ all the bundles that app A requires are here.
         also app A has a main bundle here

I can use Eclipse Application run option to launch it or comandline
"java -cp startup.jar org.eclipse.core.launcher.Main -
application myApp.Application ..."

However, I am exploring the option to launch app A with another existing
java program B. As a prototype, I am writing a plain POJO with main method:

   public static void main(String[] args) throws Exception {
       String[] equinoxArgs = { "-console", "-noExit" };
       BundleContext context = EclipseStarter.startup(equinoxArgs, null);
       String pluginDir = "
       String commonJarName =
       String configJarName =
       Bundle commonBundle = context.installBundle(pluginDir +
       Bundle configBundle = context.installBundle(pluginDir +
       String jarName = "fetchlets.jar";
       String directoryPath = "
       String locationStr = directoryPath + jarName;

       Bundle bundle = context.installBundle(locationStr);

However, my bundle fetchlets.jar cannot be started because, the
configurator bundle does not auto-discover all the required bundles in
the plugins directory. Can someone help me figure out if I can tell the
EclipseStarter to auto-load all bundles at a specific locations?

Or is there another approach I can use that is very similar to the run
options in Eclipse where setting the platform will suffice to load all
the plugins automatically?

I have been looking at:

equinox-dev mailing list

GIF image

GIF image