-1

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.

  • `web-proxy.in.softgrp.net` vs `web-proxy.us.softwaregrp.net` the proxies are different, try with the same – DDS May 04 '21 at 08:10
  • Where exactly does it say that an environment variable called `https_proxy` is supported? – user207421 Jun 10 '21 at 03:41

1 Answers1

-1

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Of course it does. That has exactly the same effect as the `-D` argument you used before. The problem here is that you just made up a non-existent environment variable and wondered why it didn't work. Why should it? – user207421 Jun 10 '21 at 03:45