Creating Your First OSGi Bundle: Step-by-Step Guide
330 likes | 430 Views
Learn how to create your first OSGi bundle using Eclipse IDE. This tutorial covers creating a new project, writing an activator Java file, configuring the MANIFEST.MF file, and running your bundle. Understand how to create an OSGi service bundle and interface. Importing necessary packages and creating a SWT bundle helps you get started. Modify your MENIFEST.MF file to avoid version errors and export your JAR file. Utilize the MANIFEST.MF effectively for your OSGi bundle.
Creating Your First OSGi Bundle: Step-by-Step Guide
E N D
Presentation Transcript
Bundle with SWT • package testbundle; • import org.osgi.framework.BundleActivator; • import org.osgi.framework.BundleContext; • import org.eclipse.swt.widgets.Display; • import org.eclipse.swt.widgets.Shell; • public class Activator implements BundleActivator { • Display display = new Display(); • public void start(BundleContext context) throws Exception { • System.out.println("Hello World!!"); • Shell shell = new Shell(display); • shell.setText("Hello world!"); • shell.open(); • //while (!shell.isDisposed()) { • //if (!display.readAndDispatch()) display.sleep(); • //} • //display.dispose(); • } • public void stop(BundleContext context) throws Exception { • System.out.println("Goodbye World!!"); • display.dispose(); • } • }