tags:

views:

20

answers:

2

I am aware of the clear command in a Terminal that will clear off the screen and return you to just (in my case): harrisbookpro: ~harris$ and I just wanted to see if it was possible to do the same in my program (which runs through the terminal).

+1  A: 

if you are using a terminal that undersands ansi-esc codes (like for example any linux terminal that uses the xterm protocol) you can use

System.out.println("\033[2J\n");

to clear the screen

Nikolaus Gradwohl
thanks a lot! it turned out to only work when i compile the .java files.
harris
+1  A: 

System.out.println("\033[2J"); works on Linux.

Dave