Bilder aus dem Web in Applikation anzeigen

Hab es ausprobiert, aber da bekomme ich folgende Exception:
Code:
Exception in thread "main" javax.imageio.IIOException: Can't get input stream from URL!
	at javax.imageio.ImageIO.read(Unknown Source)
	at II2.main(II2.java:17)
Caused by: java.net.ConnectException: Connection timed out: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.URL.openStream(Unknown Source)
	... 2 more

Woran kann das liegen? :(

//EDIT: Jetzt kommt zwar keine Exception, allerdings gibt er in der Konsole
Code:
http://www.webshotspro.com/gd/show.php/400x300/screenshots/cff81936b955dfdecbdd987a11dcb57d.jpg
http://www.webshotspro.com/gd/show.php/400x300/screenshots/cff81936b955dfdecbdd987a11dcb57d.jpg
ERRORED
aus.
 
Zuletzt bearbeitet:
In beiden Fällen ist das Problem: Can't get input stream from URL
Vll. bist du über einen Proxy im Internet... schau dir das mal an:
http://forums.sun.com/thread.jspa?threadID=5381499
Da man ja nie weiß, wie lang es den Link noch gibt poste ich nun nochma was da interessantes steht:
Java:
   SocketAddress address = new InetSocketAddress(hostName, port);
             
             // Create an HTTP Proxy using the above SocketAddress.
             Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
             
             URL url = new URL("www.example.com/image.jpg");
             
             // Open a connection to the URL using the proxy information.
             URLConnection conn = url.openConnection(proxy);
             InputStream inStream = conn.getInputStream();
             
             BufferedImage image = ImageIO.read(url);
Kriegst du dein Bild damit?
 

Neue Beiträge

Zurück