This is probably a silly question, but I’m pretty new to Java and I can’t figure it out.
Basically, I’m trying to download some files from a website and I want to save them to a particular folder (rather than the default of the same folder that my Java file is located in). How can I do this?
I’ve been using FileReader, BufferedReader, BufferedInputStream, and FileOutputStream classes.
Thanks 🙂
Java is pretty friendly with IO. Try something like this:
Notes:
/, it will be relative to your “current” directoryBufferedWritereasier:BufferedWriter writer = new BufferedWriter(new FileWriter(file));. It hasnewLine()andwrite(String)methods