How can I get the installation directory (absolute path) of an OSGi package by its name?

advertisements

Is it possible to get the installation directory in kind of an absolute path of a specific OSGi bundle by its name during runtime? If yes, how?

E. g. I am having a bundle with a symbolic name of com.example.e4.rcp.todo.service. From a class in a different bundle but in the same application, I want to determine the absolute installation path of com.example.e4.rcp.todo.service during runtime.

I don't know whether this is relevant, but I am using Eclipse Equinox.


There is no reliable way to get this information because OSGi bundles do not need to have an "installation directory".

For example, if I install a bundle in the following way, there will be nothing associated with the bundle that has any connection to the filesystem:

context.installBundle("urn:mybundle", new URL("http://...").openStream());