我用舊的項目工作,並具有以下行: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