Sounds like it's appending to the file when you expected it to overwrite instead. If that's the case, did you try using BufferedWriter.write() instead of append()?