Search code examples
eclipse-rcprcp

Using variables in config.ini property OSGI.bundles


Config.ini file is having the property osgi.bundles which contains the list of plugins that needs to be started while launching my RCP. For Eg.:

osgi.bundles=reference\:file\:org.junit_4.8.2.v4_8_2_v20110321-1705/@4,reference\:file\:org.mortbay.jetty.server_6.1.23.v201012071420.jar@4,reference\:file\:org.mortbay.jetty.util_6.1.23.v201012071420.jar@4

Clarification : I need to use the Java variables/Environment variables in the reference of the plugins. So that I can make my RCP more flexible. Please suggest a solution.

I need something like below:

osgi.bundles=reference\:file\:{ENV.USERDIR}/org.junit_4.8.2.v4_8_2_v20110321-1705/@4

Here when trying the load the bundles, JUNIT bundle should be loaded from the replaced from the environment variable USERDIR as.

c:/users/username/org.junit_4.8.2.v4_8_2_v20110321-1705

Any help is appreciated.

Thanks in advance, Vikram


Solution

  • This is supported in org.eclipse.equinox.launcher_V1.3.0 or higher. You can use the environment variables like

    $variable_name$/bundle-name.jar.

    While parsing the config file, The launcher will substitute the value of the variable and start the bundle from the specified location.