import org.apache.log4j.Logger; public class SystemUtil { private static final Logger logger = Logger.getLogger(SystemUtil.class); /** * Current system environment variable name */ public static final String SYSTEM_PROPERTY = "BACK_CONFIG"; /** * Get the configuration file path from the current system environment variables * * @return */ public static String getConfigPath() { return SystemUtil .resolveSystemProperty(SystemUtil.SYSTEM_PROPERTY); } public static String resolveSystemProperty(String key) { try { String value = System.getProperty(key); if (value == null) { value = System.getenv(key); } return value; } catch (Throwable ex) { logger.error("Failed to get system environment variables, key=" + key, ex); return null; } } }
Get variables in the system environment
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326166646&siteId=291194637
Recommended
Ranking