Your First OSGi Bundle Using Eclipse/Equinox

From CDOT Wiki
Revision as of 09:45, 28 January 2011 by Selmys (talk | contribs) (Your First OSGi Bundle in Eclipse)
Jump to: navigation, search

Your First OSGi Bundle in Eclipse

First, start in the Java perspective and select a new Plug-in Project.

Osgi-1.png

Give a name to your project and check OSGi standard framework.

Osgi-2.png

In the Content window just click Next.

Osgi-3.png

In the Template window select Hello OSGi Bundle and click Next.

Osgi-4.png

You can make changes to the Start/Stop messages and click Finish.

Osgi-5.png

Switch to the Plug-in perspective by clicking Yes.

Osgi-6.png

You now see your project overview in the edit window.

Osgi-7.png

For a different view of the manifest, open it with the editor.

Osgi-8.png

The manifest in text for looks like this.

Osgi-9.png

Use the editor to make changes to the Activator.java program.

Osgi-10.png

Right click on the MANIFEST.MF tag in the Package window and select Run As followed by Run Configurations.

Osgi-11.png

Click on the New launch configuration icon at the top left.

Osgi-12.png

Give your bundle a name and uncheck Target Platform and click Apply followed by Run.

Osgi-13.png

Be sure to save your work first.

Osgi-14.png

In the Console window you can see your bundle running.

Osgi-15.png

Type 'ss' in the console window.

Osgi-16.png

Type 'stop 1' in the console window.

Osgi-17.png

Type 'close' in the console window.

Osgi-18.png

Congratulations! You've just run your first OSGi Bundle using Eclipse.