0

i want to use a jar (plugin for OSGI platform) in my java application (simple console application).

I try to use it, in standard way, including all jars in my classpath e instanziate object and then call method A, but at same point Method A call a instruction that involve Platform:

Platform.getBundle("com.example.resource").getResource("icons/icon.png")

as expected it give me a Null pointer Exception.

i try different solution but nothing work (i'm not very expert of osgi world). There is a simple way to initialized all bundle and plugins, so i can call method A?

i try to create org.eclipse.equinox.launcher.Main instance calling run with -initialize, then call method A but don't work.

Gian C.
  • 169
  • 1
  • 8

1 Answers1

0

Platform is not from an OSGi spec. It is Eclipse specific. So I think this only works if the bundle is started with an eclipse starter.

You seem to already have done that. The problem is how to refer to the bundle from you console application. To get this working see questions in stack overflow about how to call and OSGi service from non OSGi code.

Community
  • 1
  • 1
Christian Schneider
  • 19,420
  • 2
  • 39
  • 64