Download image from web url in java?
<pre><code>URL url = new URL("http://localhost:8080/Work/images/abt.jpg");

        InputStream in = new BufferedInputStream(url.openStream());
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int n=0;
        while (-1!=(n=in.read(buf)))
        {
           out.write(buf, 0, n);
        }
        out.close();
        in.close();
        byte[] response1 = out.toByteArray();

        FileOutputStream fos = new FileOutputStream("C://abt.jpg");
            fos.write(response1);
            fos.close();
</code></pre>

<p>in this code there is some error in last 3 lines</p>

<pre><code>FileOutputStream fos = new FileOutputStream("C://abt.jpg");
                fos.write(response1);
                fos.close(); 

   SEVERE: Servlet.service() for servlet ImageDownloadServlet threw exception
java.io.FileNotFoundException: C:/abt.jpg (No such file or directory) 
</code></pre>

<p>this is the error 
any one can help me??</p>

<p>Thanks in advance.</p>
