It looks like the system bundle publishes a service of type
org.eclipse.osgi.service.environment.EnvironmentInfo. Bind to this in your
DS component, and then you can get the command line args along with various
other goodies.

I expect this will be available in any Eclipse application. I should point
out that in fully-general OSGi, command line args are not always going to
be available. The command line args are only seen by the 'public static
void main' of the Java application, and it's the launcher's choice on
whether and how to expose that information to bundles in OSGi.

Regards,
Neil



On Thu, Apr 19, 2018 at 12:41 PM, Lars Vogel <lars.vo...@vogella.com> wrote:

> Friends of OSGi,
>
> I'm currently migrating a few earlyStartup actions to OSGI DS services
> in an Eclipse RCP application.
>
> One of the OSGi services needs to have access to the command line
> arguments.
>
> For the earlyStartup extension, this was solved by putting the
> relevant argument into a system property during the start method of
> the IApplication implementation.
>
> But in our case, the new OSGi service gets started before the
> IApplication sets the system property.
>
> Can I access the launcher arguments within an OSGi service?
>
> Best regards, Lars
>
> --
> Eclipse Platform project co-lead
> CEO vogella GmbH
>
> Haindaalwisch 17a, 22395 Hamburg
> Amtsgericht Hamburg: HRB 127058
> Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
> USt-IdNr.: DE284122352
> Fax (040) 5247 6322, Email: lars.vo...@vogella.com, Web:
> http://www.vogella.com
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to