“线程中的异常”;“主要”;java.net.ConnectException:连接超时:连接

“线程中的异常”;“主要”;java.net.ConnectException:连接超时:连接,java,Java,只是我正在尝试使用URL读取HTML文件。但是获取超时异常 源代码: import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { System.setProperty("java.net.useSystemProxies","true"); URL oracle = new U

只是我正在尝试使用URL读取HTML文件。但是获取超时异常

源代码:

import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {
        System.setProperty("java.net.useSystemProxies","true");
        URL oracle = new URL("http://www.oracle.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();
    }
}

这个代码对我来说很好用,请检查你的互联网连接。

你有stacktrace吗?你的代码在这里工作。检查你的互联网连接。