[英]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.我有一个可执行的 jar 文件,它获取 gcp 区域。 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.这个 jar 在我按如下方式发出时可以工作:
java -Dhttps.proxyHost=web-proxy.in.softgrp.net -Dhttps.proxyPort=8080 -jar sample.jar
where web-proxy.in.softgrp.net is the proxy host.其中 web-proxy.in.softgrp.net 是代理主机。
But if I set the same proxy via export command and then issue java -jar sample.jar it does not work.但是,如果我通过导出命令设置相同的代理,然后发出 java -jar sample.jar 它不起作用。 Any reasons why?
有什么理由吗?
$>export https_proxy=http://web-proxy.us.softwaregrp.net:8080
$>java -jar sample.jar
This is failing to fetch required info. $>export https_proxy=http://web-proxy.us.softwaregrp.net:8080
$>java -jar sample.jar
这无法获取所需的信息。 I get SSL handshake exception for the same.我得到同样的 SSL 握手异常。
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.而不是通过 cmd 行中的导出命令设置它们并运行 jar 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.