code: public static String getProperty(String key, String defaultValue, String text) {
  		try {
  			String propVal = System.getProperty(key);
  			if (propVal == null) {
  				// Fall back to searching the system environment.
  				propVal = System.getenv(key);
  			}
  			if (propVal == null) {
  				// Try with underscores.
  				String name = key.replace('.', '_');
  				propVal = System.getenv(name);
  			}
  			if (propVal == null) {
  				// Try uppercase with underscores as well.
  				String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_');
  				propVal = System.getenv(name);
  			}
  			if (propVal != null) {
  				return propVal;
  			}
  		}
  		catch (Throwable ex) {
  			System.err.println("Could not resolve key '" + key + "' in '" + text
  					+ "' as system property or in environment: " + ex);
  		}
  		return defaultValue;
  	}
docs: Search the System properties and environment variables for a value with the
  provided key. Environment variables in {@code UPPER_CASE} style are allowed where
  System properties would normally be {@code lower.case}.
  @param key the key to resolve
  @param defaultValue the default value
  @param text optional extra context for an error message if the key resolution fails
  (e.g. if System properties are not accessible)
  @return a static property value or null of not found