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.