Frage

I hava a jar file named floodlight.jar. I can run it in cmd line: java -jar floodlight.jar. Now I want to convert it into a bundle to deploy with FUSE ESB container. Here is what I did so far:

  1. convert:

     java -jar bnd.jar wrap floodlight.jar
    

    result in a bundle named floodlight.bar. change the name to floodlight.jar

  2. deploy

    FuseESB:karaf@root> osgi:install -s file:/home/usr/Dir/to/floodlight.jar
    

I hope the bundle can do the same thing as what i did in cmd line: java -jar floodlight.jar once it getting started. However, it is active without doing anything. It just behaves like a library.

I am wondering how to let the bundle run the main class once it is started. Anyone can help me?

War es hilfreich?

Lösung

The entry point for OSGi applications are BundleActivator's. You can not invoke the main-method like in standard Java applications. However, you can do all the stuff you would do in the main method in the start(BundleContext) method of your bundle.

So, implement the BundleActivator interface and add it to your manifest.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top