I have a executable jar file which fetches gcp regions. This jar works when I issue it as below: java -Dhttps.proxyHost=web-proxy.in.softgrp.net -Dhttps.proxyPort=8080 -jar sample.jar This command works. where web-proxy.in.softgrp.net is the proxy host.

But if I set the same proxy via export command and then issue java -jar sample.jar it does not work. Any reasons why? $>export https_proxy=http://web-proxy.us.softwaregrp.net:8080 $>java -jar sample.jar This is failing to fetch required info! I get SSL handshake exception for the same.

1

There are 1 best solutions below

1
On

It worked when I set the proxy programmatically:

System.setProperty("http.proxyHost", getHTTPHost());
System.setProperty("http.proxyPort", getHTTPPort());
System.setProperty("https.proxyHost", getHTTPHost());
System.setProperty("https.proxyPort", getHTTPPort());

instead of setting them via export command in cmd line and running the jar file.