1. I assume you’re talking about java
  2. You wouldn’t be able to achieve your goal without writing some extra code. Below is the example of how you can to that:

Example pre-conditions:

  • your property is called “test.

  • the property that you want to take is called “somepropname”

  • environement variable you want to take propertyvalue from is “some-prop-env-name”

It is also worth mentioning that in such the appoach you can either:

  • set a property in a property file and thus it will be picked from the file

  • do not set a property in a file. If it will not present in a file it will be picked from environment variable

The example itself:

public static void main(String args[]) {

    Properties prop = new Properties();
    final String SOME_PROP_ENV_NAME = "some-prop-env-name";

    try {
        prop.load(new FileReader("test.properties"));
        String propValue = prop.getProperty("somepropname", System.getenv().get(SOME_PROP_ENV_NAME));
    } catch (IOException e) {


What’s been basically done is using getProperty(propName, defaultValue) method where defaultValue is taken from an environment variable.

Source link https://sqa.stackexchange.com/questions/28736/use---in--properties-file


Please enter your comment!
Please enter your name here