我试图通过使用此代码HTTP错误407需要代理授权
System.setProperty("http.proxyHost", "111.88.15.108");
System.setProperty("http.proxyPort", "8002");
System.setProperty("http.proxyUser", "user");
System.setProperty("http.proxyPassword", "password");
URL oracle = new URL("http://www.google.com/");
URLConnection yc = oracle.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
这是在我的窗口机器工作正常访问的URL,但这不是在Linux机器上运行。我得到eror像线程 “主” 产生java.io.IOException这个
例外:服务器返回的HTTP响应代码:407网址:http://www.google.com/ 在sun.net.www.protocol.http.HttpURLConnection .getInputStream(来源不明) 在com.yahoo.Connection.main(Connection.java:31)
即使是代理设置是正确的,我想这样也
java -Dhttp.proxyHost="111.88.15.108" -Dhttp.proxyPort="8002" -Dhttp.proxyUser="user" -Dhttp.proxyPassword="password" -jar yahoo_test3.jar
但同样的错误,我试图设置出口HTTP_PROXY =在/ etc/profile文件,但没有用
任何想法,这是怎么了。
你可能需要在你的Linux机器设置为使用您公司的Active Directory身份验证系统。 – fge