shivaraj malannavar
shivaraj malannavar

Reputation: 11

jar file execution works with -Dhttps.proxyHost option but does not work when I set the same proxy via export and then if I run java -jar sample.jar

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.

Upvotes: -1

Views: 732

Answers (1)

shivaraj malannavar
shivaraj malannavar

Reputation: 11

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.

Upvotes: -1

Related Questions