1. Download and install eclipse
Http://www.eclipse.org/downloads
The eclipse version is v3.3.1.
2. Create a new project 1. Select
File > New > Other...
2. Select plug-in development> plug-in project and next
3. Enter a project name and next
4. Set the package name of the activator file. If the package does not exist, eclipse will create it. Next
5. Select a template. You do not need to select any template. Finish
6. Project Structure
3. write code
1. Edit the activator. Java File
Delete unnecessary code. All content of the file is as follows:
package cn.org.tuscany;
import org.osgi.framework.*;
public class Activator implements BundleActivator {
public void start(BundleContext context) {
System.out.println("Hello World!");
}
public void stop(BundleContext context) {
System.out.println("Goodbye World!");
}
}
2. Edit the manifest. MF File
The content is as follows:
Manifest-version: 1.0
Bundle-manifestversion: 2
Bundle-Name: osgi_equinox_helloworld plug-in
Bundle-symbolicname: osgi_equinox_helloworld
Bundle-version: 1.0.0
Bundle-Activator: cn.org. Tuscany. Activator
Import-package: org. osgi. Framework
(Note: there must be an empty line without any spaces)
Iv. Run
- 1. In the project list on the left, right-click the project and choose run as> osgi frameword from the context menu...
Now, equinox Hello world in eclipse environment is complete.
This is a basic operation process for developing equinox bundle using eclipse.