can any one write me the program to dowmload imges using java. i have wriitten a program using URL class it is able download index.html pages but not able to download images.
my source code:
import java.net.*;
import java.io.*;
public class url {
public static void main(String[] args) {
try {
URL u = new URL("http://www.idlebrain.com/movie/photogallery/ashtachemma/index.html");
InputStream is = u.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String theLine;
while ((theLine = br.readLine()) != null) {
System.out.println(theLine);
}
}
catch (MalformedURLException ex) {
System.err.println(ex);
}
catch (IOException ex) {
System.err.println(ex);
}
}
}