{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner

How to Run a NetBeans Platform Application as OSGi Bundles

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.

  1. 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.

  2. Go to File | New Project and select the "NetBeans Platform Application" template:

  3. Click Next and then provide a name and a location for your new project:

  4. 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
  5. Right-click the application in the Projects window, find the "OSGi" menu item, and then select the "Run in Felix" submenu:

  6. In the Output window, notice that Felix starts up, deploying the application:

  7. The following application appears:

  8. Several features are provided by default, such as the Favorites window, Output window, and very basic editor support, as shown below:

  9. 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:

Read http://wiki.netbeans.org/NetBeansInOSGi again to answer any questions you might still have.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks