public static String getEnv(String name, String defaultValue) {
        Map<String, String> env = System.getenv();

        // try to get value from environment variables
        if (env.get(name) != null) {
            return env.get(name);
        }

        // fall back to system properties
        return System.getProperty(name, defaultValue);
    }
public static String getEnv ( String name , String defaultValue ) { Map < String , String > env = System . getenv ( ) ; if ( env . get ( name ) != null ) { return env . get ( name ) ; } return System . getProperty ( name , defaultValue ) ; }
returns values for a key in the following order:
1. First checks environment variables
2. Falls back to system properties

@param name
@param defaultValue
@return