简体   繁体   English

jar 文件执行适用于 -Dhttps.proxyHost 选项,但当我通过导出设置相同的代理然后运行 java -jar sample.Z68995FCBF432492D15484D04A9D2AC04 时不起作用

[英]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.

相关问题 Java:未使用-Dhttps.proxyHost - Java: -Dhttps.proxyHost not being used 当我将Java导出为可运行的jar文件时,不起作用 - When i export my java as runnable jar file, do not work 当我将项目导出到JAR文件时,SourceDataLine不起作用 - The SourceDataLine does not work when I export my project into JAR file Java -jar“ / users / admin / Sample code / sample.jar”-空间问题 - Java -jar “/users/admin/Sample code/sample.jar” - Space issue .jar文件中的图片在导出时不起作用 - Picture inside .jar file wont work when I export it 使用Android Studio导出jar时没有jar文件 - There is no jar file when I use Android Studio to export jar 当我正常运行Java jar文件时,一切正常,当在任务sheduler中运行相同的jar时,存在一些问题 - When I run java jar file normally everything is okey, when run the same jar in task sheduler, there are some issues 为什么如果我从 NetBeans 运行一个 java 项目它可以工作但 jar 文件 deosn 不能正常工作? - Why if I run a java project from NetBeans it works but the jar file deosn not work well? 如何在java中运行.jar文件 - How can i run a .jar file in java 当我从jar运行我的应用程序时,为什么新的File(path)不起作用? - Why does new File(path) doesn't work when I run my application from jar?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM