Hi I am new to Java. I am trying to develop a tool in which I am trying to download a file from a link. When I go to that link using my java program, IE is opened and its default File Download window is showing. But I need to browse the path to save that file in this case. But my requirement is to save the file in a default path where I set.

How can I set the default path to save downloaded file?

Can anybody help me in this issue....? Advance thanks...

Well, how are you "doing" the download?

I would assume you would use a HttpURLConnection and a JFileChooser, but it seems you are using Desktop.open(), no?

I have saved some URLs in an XML file with some tag names such as macid. And my program parses the XML and take that URL.

This is the code I have used..:-

"java.awt.Desktop.getDesktop().browse(new URI(nodeName.item(0).getNodeValue()));"

Yep, you can't control that (AFAIK), unless IE has some option, but that's a Microsoft question. As I said, use HttpURLConnection and JFileChooser, Google for some tutorials.

Thank you very much Masijade..... It works...
I used this one:-

URL url = new URL("url");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();

InputStream inStrm = httpCon.getInputStream();
int ch;
while (((ch = inStrm.read()) != -1))
System.out.print((char) ch);

And it works fine.....

Thanks Once again.... :-)

Uhm, I wouldn't use read(), use the byte[] version of the read method (properly), as you are liable to find that version you're using to be extremely slow.