posted 12 years ago
Now, you are creating 2 files; one in the same place where you were creating before, one in the place where you want to create. Which FileOutputStream are you writing your bytes to? If you write to fos, and not to location, then the file that location points to will have 0 bytes, and the file that fos points to will have all the bytes
BTW, if you want to create the file in the user's home directory, it's better to use "user.home" system property rather than hardcoding the path in your code