0

all! Is there any way to remove text that has been printed to the console? I can write a message easy enough with

System.out.println("Hello world!");

but how do I remove it once it's been put up? It is possible to do so? I am using the Eclipse IDE, by the way.

public static void
  • 95
  • 1
  • 6
  • 13
  • 1
    If you're interested in clearing Eclipse console, then you can look at [Eclipse APIs](http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fconsole%2Factions%2FClearOutputAction.html) for that. – PM 77-1 Aug 09 '14 at 23:34

1 Answers1

0

It's possible sometimes, but mostly not. To do it, you have to be outputting to a terminal that handles ANSI escape sequences, and output the ANSI escape sequence that moves up a line, then output a bunch of spaces. I believe the ANSI sequence for "up one line" is \033[1A. Of course, if your output wrapped, one line might not be enough...

You've tagged your question eclipse. I'm pretty sure the output panel of Eclipse doesn't support ANSI escape sequences.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875