This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hai friends, Can i download a file from a remote system( I mean a file from internet)to own machine using java program. The file should automatically saved into the filepath specifed in the program. It should not ask for the path, as in a normal download operation.
What are you about to implement? A Java application, applet, ejb? For applets you need special rights to write contents to the users machine. For java applications you just can do anything you like. If the file is available via http just use the URLConnection class to refer to this file on the internet and get the input stream of this file. Then you can write the bytes to a local file of your choice. For EJBs is file access restricted, but might work. Try it in your app server but your code might not be portable to other app servers. [ September 04, 2003: Message edited by: Peter Storch ]
Hi R�stem e Zal ! The code I've given is infact correct. In your code u've used readln() from a stream. One should remember that streams operate on bytes while readers operate on chars. readline() should be used only with readers and not with streams.