我用旧的项目工作,并具有以下行:java System.getProperties()。put();
System.getProperties().put("http.proxyHost", proxyHost);
该订单更改系统属性http.proxyHost?
我用旧的项目工作,并具有以下行:java System.getProperties()。put();
System.getProperties().put("http.proxyHost", proxyHost);
该订单更改系统属性http.proxyHost?
是的,它的工作原理:
System.getProperties().put("http.proxyHost", "1.2.3.4");
String x = (String) System.getProperties().get("http.proxyHost");
System.out.println(x); // prints 1.2.3.4
它不会改变之外,你程序的系统性能。
System.getProperties()
返回Properties
对象。每次调用getProperties()
方法都会返回相同的对象。
但是你可以在这个对象中添加或覆盖性和与调用put
完成。
因此,实际上,在程序中通过System.getProperties().get("http.proxyHost")
返回值被改变。
之后您可以通过另一个'getProperties'进行检查。请回报。 – Thilo