Create OSGI Bundle in Eclipse
Creating OSGI Project
Step 1: Go to the File menu -> Go to Other… -> Select the Plug-in-Project under the Plugin-in-Development in the wizard.
Step 2: Give name for your project and make sure you are selecting target platform is an OSGI Framework in the wizard.
Step 3:
Step 4:
Step 5:
Step 6:
Project Structure
Activator.java
package com.dineshkrish; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; /** * * @author Dinesh Krishnan * */ public class Activator implements BundleActivator { public void start(BundleContext context) throws Exception { System.out.println("Hello Everyone - Bundle is started!!!"); } public void stop(BundleContext context) throws Exception { System.out.println("Goodbye Everyone - Bundle is stoped!!!"); } }
MANIFEST.MF
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: MyBundle Bundle-SymbolicName: MyBundle Bundle-Version: 1.0.0.qualifier Bundle-Activator: com.dineshkrish.Activator Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: org.osgi.framework;version="1.3.0" Bundle-ActivationPolicy: lazy
Running the bundle
Output
More from my site

Hello, folks, I am a founder of idineshkrishnan.com. I love open source technologies, If you find my tutorials are useful, please consider making donations to these charities.
No responses yet