-1

Running my code, I would like to save all the System.out.println() in a file.

For example:

System.out.println("Save this!");

I would need a file .txt in which is stored the string "Save this!".

Someone could help me?

Regards,

Francesco Campanile

1 Answers1

0

Use this to Write console to a file.

PrintStream out = new PrintStream(
        new FileOutputStream("output.txt", true), true);
System.setOut(out);

The output file will be on your project's root directory

HotJava
  • 135
  • 2
  • 14