Java Using proxy settings in jar

Tags: ,



I’m doing a webscraping with jar i created, which uses a proxy. My question is that i have large project where more webscrapers will work in paralel.

Using this code:

System.getProperties().put("http.proxyHost", "someProxyURL");
System.getProperties().put("http.proxyPort", "someProxyPort");
System.getProperties().put("http.proxyUser", "someUserName");
System.getProperties().put("http.proxyPassword", "somePassword");

will affect the others webscrapers?

Answer

If you run them as separate processes, then each process has its own system properties. If you are running them in one process as separate threads, they share those properties.



Source: stackoverflow