code: public static String substituteVariables(String value) {
          Matcher matcher = varPattern.matcher(value);
          boolean found = matcher.find();
          if (!found) {
              return value;
          }
          StringBuffer sb = new StringBuffer();
          do {
              String sysPropKey = matcher.group(1);
              String sysPropValue = getSystemVariableValue(sysPropKey, null);
              if (sysPropValue == null || sysPropValue.length() == 0) {
                  throw new RuntimeException("System property " + sysPropKey + " is not specified");
              }
              // Due to reported bug under CARBON-14746
              sysPropValue = sysPropValue.replace("\\", "\\\\");
              matcher.appendReplacement(sb, sysPropValue);
          } while (matcher.find());
          matcher.appendTail(sb);
          return sb.toString();
      }
docs: Replace system property holders in the property values.
  e.g. Replace ${carbon.home} with value of the carbon.home system property.
  
  @param value string value to substitute
  @return String substituted string