My question is related to this one. However, I am looking for a way to append the text file over several runs. is there a way to write console output to a text file without erasing the old runs information? I am working on 30+ classes and it would be tedious to change System.out.println
statements so I prefer sticking with the System.setOut
solution.
I have the following code based on @Mac answer
PrintStream out = new PrintStream(new FileOutputStream("aa.txt"),true);
System.setOut(out);
but the file aa.txt
does not append the results, am I missing something here?