OSGi Learning Path (2)-Establishment of OSGI development environment _OSGI

Source: Internet
Author: User

What's 1.1 Equinox?

From a code standpoint, Equinox is actually a complete implementation of the OSGi core standard, and adds some additional functionality on this basis (such as adding a command line and a program execution entry for the framework). All of the things we've been explaining in the previous introductory article are a small part of the OSGi core standard. In fact, its core is a jar package, which can be executed (as a standard Java package feature), but also a bundle (manifest contains osgibundle-specific metadata).
Now all you need to know is that we can use the code of the Equinox project to run a real OSGi framework that, after the framework starts, allows you to run your development bundle.

1.2 Download Equinox

Equinox has an official download on the Http://download.eclipse.org/equinox, which lists various versions for us to choose from:

Here, we use the 3.7 version of Equinox, download it and put it in a separate folder (here my path is E:\OSGiframework\equinox):

1.3 Starting the frame from the command line

If you start this frame, it's enough to have the jar package above, and we enter the command line with the following command: Java–jar org.eclipse.osgi_3.7.0.v20110613.jar-console, and then we'll go to the Equinox console:

If a osgi> prompt appears, it indicates that the startup was successful.
Some of the basic commands for the Equinox console are as follows (case-sensitive): 1.4 Creating a development environment in eclipse

In the previous section you see the method of starting and controlling the framework, which is a fairly simple process. But just running the environment is not enough, we also need to develop the environment. 1.4.1 Settings

First, we don't need to install the necessary plug-ins, as long as you have a newer version of Eclipse on the line. Then go to Eclipse's window->preferences interface and select Target Platform under Plug-indevelopment:

Right now there is only one runing platform, our task is to click the "Add ..." button to add one of our own platform,

Select the default first one, and click Next.

Then click "Add ..." here:

Select "Directory":

Select the path of your Equinox jar package and click Finish to return to the interface:

That's when you find out that the path you just set, the "1 plug-ins available" described later in the path, is the Equinox jar package we placed.
Click Finish to go back to the beginning of the screen:

This time a new targetplatform, tick, and then OK. 1.4.2 Start

Open menu item Run->run configurations ..., in the OSGi framework entry, create a new Run configuration:

Now that the Equinox jar package has been automatically included, click Run to see how it works:

An OSGi prompt is also present in Eclipse's console, indicating that you have successfully started.

You can try the commands you just talked about and see what you can output (for example, I've entered SS in the picture above). 1.4.3 Create a new project

Open the new project's interface and choose Plug-in Project:

Then enter the name of project, TargetPlatform Select an Osgiframework->equinox or standard, click Next:

This is actually the setting for the bundle manifest file, where the ID is bundle-symbolicname,version is the bundle version number, and the following can also determine whether to define Bundleactivator, Click Finish to create a project:

At this point, the development environment has been established.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.