You are viewing outdated content for BUG. If you have a BUG Y.T. edition or 2.0 series device, please visit our updated wiki: http://wiki.buglabs.net



Create a basic application

From BUG Wiki

Jump to: navigation, search

Create a basic application for BUG that displays a message on the system output console.

  1. If necessary, switch Perspective to the Dragonfly perspective.
  2. Select the New BUG Project icon in the toolbar.
  3. In the New BUG Project window, in the Name field, type: HelloWorld
  4. Click Finish.
  5. In left-side Project Explorer view, expand the node for the Hello World application
  6. Expand the node for the helloworld package
  7. Double-click on Activator.java to edit it
  8. In the Java editor, in the start method of activator class, type: System.out.println("Hello World :)");
    so that it looks like this:
package helloworld;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

	public void start(BundleContext context) throws Exception {
		// TODO Auto-generated method stub
		System.out.println("Hello World :)");
	}

	public void stop(BundleContext context) throws Exception {
		// TODO Auto-generated method stub
		
	}
 }
  1. Go to File > Save to save Activator.java.
  2. Click Run, Run As Virtual BUG to launch your application in the Virtual BUG.
  3. Watch the output on the Console tab in Eclipse/Dragonfly for your "Hello World :)" message. The text is highlighted in the screen shot below.

Image:HelloWorld_screen.JPG