Open main menu

CDOT Wiki β

Changes

Your First OSGi Bundle Using Eclipse/Equinox

897 bytes added, 10:45, 28 January 2011
Your First OSGi Bundle in Eclipse
== Your First OSGi Bundle in Eclipse ==
First, start by selecting in the Java perspectiveand select a new Plug-in Project.
[[Image:osgi-1.png|left|thumb]]<br style="clear:left;" />
Give a name to your project and check OSGi standard framework.
[[Image:osgi-2.png|left|thumb]]<br style="clear:left;" />
In the Content window just click Next.
[[Image:osgi-3.png|left|thumb]]<br style="clear:left;" />
In the Template window select Hello OSGi Bundle and click Next.
[[Image:osgi-4.png|left|thumb]]<br style="clear:left;" />
You can make changes to the Start/Stop messages and click Finish.
[[Image:osgi-5.png|left|thumb]]<br style="clear:left;" />
 [[Image:osgiSwitch to the Plug-5in perspective by clicking Yes.png|left|thumb]]<br style="clear:left;" /> 
[[Image:osgi-6.png|left|thumb]]<br style="clear:left;" />
You now see your project overview in the edit window.
[[Image:osgi-7.png|left|thumb]]<br style="clear:left;" />
For a different view of the manifest, open it with the editor.
[[Image:osgi-8.png|left|thumb]]<br style="clear:left;" />
The manifest in text for looks like this.
[[Image:osgi-9.png|left|thumb]]<br style="clear:left;" />
Use the editor to make changes to the Activator.java program.
[[Image:osgi-10.png|left|thumb]]<br style="clear:left;" />
Right click on the MANIFEST.MF tag in the Package window and select Run As followed by Run Configurations.
[[Image:osgi-11.png|left|thumb]]<br style="clear:left;" />
Click on the New launch configuration icon at the top left.
[[Image:osgi-12.png|left|thumb]]<br style="clear:left;" />
Give your bundle a name and uncheck Target Platform and click Apply followed by Run.
[[Image:osgi-13.png|left|thumb]]<br style="clear:left;" />
Be sure to save your work first.
[[Image:osgi-14.png|left|thumb]]<br style="clear:left;" />
In the Console window you can see your bundle running.
[[Image:osgi-15.png|left|thumb]]<br style="clear:left;" />
Type 'ss' in the console window.
[[Image:osgi-16.png|left|thumb]]<br style="clear:left;" />
Type 'stop 1' in the console window.
[[Image:osgi-17.png|left|thumb]]<br style="clear:left;" />
Type 'close' in the console window.
[[Image:osgi-18.png|left|thumb]]<br style="clear:left;" />
'''Congratulations!''' You've just run your first OSGi Bundle using Eclipse.
63
edits