I want to define a property for a working directory(say work.dir=/home/username/working-directory), for my production .properties file, without hard-coding the
work.dir=/home/username/working-directory
Get the property from the file, then replace supported macros.
String propertyValue = System.getProperty("work.dir"); String userHome = System.getProperty("user.home" ); String evaluatedPropertyValue = propertyValue.replace("$user.home", userHome );