E.4 PropertiesLauncher Features

PropertiesLauncher has a few special features that can be enabled with external properties (System properties, environment variables, manifest entries or application.properties).

Key Purpose
loader.path Comma-separated Classpath, e.g. lib,${HOME}/app/lib. Earlier entries take precedence, just like a regular -classpath on the javac command line.
loader.home Location of additional properties file, e.g. /opt/app (defaults to ${user.dir})
loader.args Default arguments for the main method (space separated)
loader.main Name of main class to launch, e.g. com.app.Application.
loader.config.name Name of properties file, e.g. loader (defaults to application).
loader.config.location Path to properties file, e.g. classpath:loader.properties (defaults to application.properties).
loader.system Boolean flag to indicate that all properties should be added to System properties (defaults to false)

Manifest entry keys are formed by capitalizing initial letters of words and changing the separator to “-” from “.” (e.g. Loader-Path). The exception is loader.main which is looked up as Start-Class in the manifest for compatibility with JarLauncher).

[Tip] Tip
Build plugins automatically move the Main-Class attribute to Start-Class when the fat jar is built. If you are using that, specify the name of the class to launch using the Main-Class attribute and leave out Start-Class.

Environment variables can be capitalized with underscore separators instead of periods.

  • loader.home is the directory location of an additional properties file (overriding the default) as long as loader.config.location is not specified.
  • loader.path can contain directories (scanned recursively for jar and zip files), archive paths, or wildcard patterns (for the default JVM behavior).
  • loader.path (if empty) defaults to lib (meaning a local directory or a nested one if running from an archive). Because of this PropertiesLauncher behaves the same as JarLauncher when no additional configuration is provided.
  • Placeholder replacement is done from System and environment variables plus the properties file itself on all values before use.

results matching ""

    No results matching ""