Question: I have a question about declarative OSGi Services. I have the following interface : 

```
  public interface PrintService {
    public void print();
  }

```

and its implementation: 

```
    public class PrintServiceImpl implements PrintService {

      @Override
      public void print() {
        System.out.println("Hello from PrintServiceImpl!");
      }
    }

```

OSGI-INF/component.xml :

```
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="service">
   <implementation class="service.PrintServiceImpl"/>
   <service>
      <provide interface="print.PrintService"/>
   </service>
</scr:component>

```

MANIFEST.MF :

```
Service-Component: OSGI-INF/component.xml

```

After I install the service and start it nothing happend. How can I activate it and print "*Hello from PrintServiceImpl!*" to console.

Answer: 
Why do you expect your `print` method to be invoked? It is part of the interface of the service, so it will not be invoked until you can a client that binds to it and calls it.

If you type the `services` command in the console you should see that your bundle is publishing the `print.PrintService` service; this means that your component is working. If you don't see this then you may be missing something like the SCR bundle as suggested by Tom Seidel in the comments above.
When you are use annotations, XML file will be generated automatically under OSGI-INF/... folder. 

```
  public interface PrintService {
    public void print();
  }

  implementation with annotations: 

  @Component(service = PrintService.class)
  public class PrintServiceImpl implements PrintService {

      @Activate
      public void activate() {
         print();
      }

      @Override
      public void print() {
        System.out.println("Hello from PrintServiceImpl!");
      }
    }

```

As i said before, XML file created automatically. With @Component(service = PrintService.class) annotations, we register PrintService to OSGi framework(like registerService method in ServiceTracker). When service is registered, Activate method will be called. Method name can be anything. Just add @Activate annotations to say "when service is registered, call the method which is under @Activate annotations" to OSGi Framework.