Difference between revisions of "Your First OSGi Bundle Using Eclipse/Equinox"

From CDOT Wiki
Jump to: navigation, search
(Created page with '== Your First OSGi Bundle in Eclipse == First, start by selecting the Java perspective. left|thumb<br style="clear:left;" /> left|thumb…')
 
(Your First OSGi Bundle in Eclipse)
Line 1: Line 1:
 
== Your First OSGi Bundle in Eclipse ==
 
== Your First OSGi Bundle in Eclipse ==
First, start by selecting the Java perspective.
+
First, start in the Java perspective and select a new Plug-in Project.
 
[[Image:osgi-1.png|left|thumb]]<br style="clear:left;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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:osgi-5.png|left|thumb]]<br style="clear:left;" />
 
+
Switch to the Plug-in perspective by clicking Yes.
[[Image:osgi-5.png|left|thumb]]<br style="clear:left;" />
 
 
 
 
[[Image:osgi-6.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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[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;" />
 
[[Image:osgi-18.png|left|thumb]]<br style="clear:left;" />
  
 
'''Congratulations!''' You've just run your first OSGi Bundle using Eclipse.
 
'''Congratulations!''' You've just run your first OSGi Bundle using Eclipse.

Revision as of 10:45, 28 January 2011

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.