Unable to acquire image through ImageIO.read(url) because of connection timed out
问题 The following code always seems to fail: URL url = new URL("http://userserve-ak.last.fm/serve/126/8636005.jpg"); Image img = ImageIO.read(url); System.out.println(img); I've checked the url, and it is a valid jpg image. The error I get is: Exception in thread "main" javax.imageio.IIOException: Can't get input stream from URL! at javax.imageio.ImageIO.read(ImageIO.java:1385) at maestro.Main2.main(Main2.java:25) Caused by: java.net.ConnectException: Connection timed out at java.net