0

I need to connect using proxy. It only works when I add -Djava.net.useSystemProxies=true to commandline. The problem is that it works only with installed java on computer, and I also need to run my program on computers with I would say portable java (folder JRE is copied and virtual machine is running using jre/bin/java.exe command. In this case, -Djava.net.useSystemProxies=true is not taken into account and I am not able to connect using proxy.

API I use to connect is:

List<Proxy> proxxies = ProxySelector.getDefault().select(new URI(serverURL));

Without property set to true, I don't receive a list of proxies.

  • Does this answer your question? [How do I set the proxy to be used by the JVM](https://stackoverflow.com/questions/120797/how-do-i-set-the-proxy-to-be-used-by-the-jvm) – Aaron Liu Jun 10 '23 at 18:21
  • Unfortunately not. -Djava.net.useSystemProxies=true works on some computers on others not. Why ? – Krzysztof Bil Jun 12 '23 at 08:59
  • I'm asking if setting it as an environmental variable and/or using the -Dhttp.proxyHost works. Is the answer to both no? – Aaron Liu Jun 12 '23 at 23:07

0 Answers0