用URL类访问网络抛出java.net.UnknownHostException?
------解决方法--------------------------------------------------------
java.net.UnknownHostException
这个已经很明确了吧,为止主机或者你的url写错了
把你的url发出来
------解决方法--------------------------------------------------------
如果你是通过代理上网的,也要在程序里设代理
------解决方法--------------------------------------------------------
InputStream input;
HttpURLConnection con = (HttpURLConnection) (sourceURL).
openConnection();
con.setRequestProperty("Proxy-Authorization",
"Basic " + new BASE64Encoder().encode("username:password".getBytes()));
URL url = new URL("http://www.somewhere.net/software/ACDSee60.zip");
System.out.println
(con.getResponseCode() + " : " + con.getResponseMessage());
input = con.getInputStream();