With NetBeans IDE 6.9, not only can you import OSGi bundles into existing NetBeans Platform applications, but you can also convert your entire NetBeans Platform application to a set of OSGi bundles. That is the topic outlined in the article below.
- Read the document at http://wiki.netbeans.org/NetBeansInOSGi to find out what you can (and especially what you can't) do with the (currently experimental) mode enabling NetBeans Platform modules to run natively as OSGi bundles.
The document describes what actually happens to make the OSGi-mode possible: "A small tool (currently available as an Ant task) accepts some NetBeans modules as input - normally a collection of clusters (directories containing modules/*.jar) - and as output produces a collection of OSGi bundles."
Make sure that you read the document carefully before continuining.
- Go to File | New Project and select the "NetBeans Platform Application" template:
- Click Next and then provide a name and a location for your new project:
- Click Finish, switch to the Files window, and then look at all the files that have been created:
Redefine the "platform.properties" file as follows, defining the NetBeans Platform clusters named "harness" and "platform" as the only groups of NetBeans modules relevant to the application:
Add the following to the "project.properties" file:
osgi.run.args=-ea -client -Xss2m -Xms32m -XX:PermSize=32m -XX:MaxPermSize=200m
- Right-click the application in the Projects window, find the "OSGi" menu item, and then select the "Run in Felix" submenu:
- In the Output window, notice that Felix starts up, deploying the application:
- The following application appears:
- Return to NetBeans IDE, go to the Files window, expand the "build" folder, and notice that all the erstwhile NetBeans modules in the NetBeans Platform have been converted to OSGi bundles:
Several features are provided by default, such as the Favorites window, Output window, and very basic editor support, as shown below:
Read http://wiki.netbeans.org/NetBeansInOSGi again to answer any questions you might still have.