使用java.lang.System.setProperties(Properties props)一定要先java.lang.System.getProperties()

Sets the system properties to the Properties argument.

First, if there is a security manager, its checkPropertiesAccess method is called with no arguments. This may result in a security exception.

The argument becomes the current set of system properties for use by the getProperty(String) method. If the argument is null, then the current set of systemproperties is forgotten.

setProperties参数Properties覆盖System原有的Properties。


Properties properties = System.getProperties();
properties.load(inputStream);
inputStream.close();
System.setProperties(properties);

09-24 04:08