Hi everyone. Im a student at RIT who is trying to over-achieve. Im working on an open source project, and although a lot of it is over my head, im holding my own pretty well( i survived the JDBC). Except for this part. I need to connect to the internet, download a file, and save it. I've written methods for calculating its size, MD5, all of that, but now after putting it off, i have to figure out how to download it. Just for completeness - The program is pulling the URL from a MySQL database, then connecting and downloading a program and checking its size, MD5, etc. Im stuck. Ive googled for a day now, and been through the Java Ranch, and I am lost.
Thanks alot, these forums have been INVALUABLE to learning java here at RIT.
The java.net.URL class is your friend. The precise code you'd use depends on what you want to do with the downloaded data -- put it into a file, for example, or store it in a database -- but here's one simple version: