How to clear the console after a few statements have been executed/printed in Eclipse. I have used flush() but didn't work though. Just posting the sample code.
System.out.println("execute ");
System.out.println("these set of lines ");
System.out.println("first");
Thread.sleep(2000); // just to see the printed statements in the console
System.out.flush(); // it is not clearing the above statements
The Eclipse Console does not support the interpretation of the clear screen and other ANSI escape sequences which would be required for that. Also, the ANSI Escape in Console Eclipse plug-in does not support clear screen.
In the upcoming Eclipse IDE 2019-12 (4.14) which will be released on December 18, 2019, the interpretation of the backslash (\b
) and carriage return (\r
) characters can be enabled in the preferences (see Eclipse 4.14 - New and Noteworthy - Control character interpretation in Console View):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With