Difference between runproperties and runvm?

Today I was asked what is the difference between the parameters runproperties and runvm:

E.g. for jetty it seems I can write both:

-runproperties: \



in a .bndrun file.

Seems I can override both from command line via vmargs -Dorg.osgi.service.http.port=8082

Both seem to be system properties under the hood.

Is there some kind of advice or explanation which to use when?

The launcher of bnd uses the system properties as an override when it loads the framework properties.
At the usage side, the BundleContext.getProperty is specified to retrieve value from the corresponding framework property, or fallback to a JVM system property when the key was not present within the framework properties.

The combination of the two allows for the flexibility you described. So either you define a framework property, and the launcher’s ability to look in the system properties allows you to override it using vmargs, or you configure it as a system property to begin with, and the fallback behaviour of BundleContext.getProperty ensures that the value is retrieved as well.

Personally I think using runproperties makes more sense, and you benefit from the launcher’s ability to override using command line arguments.