Skip to content
← Back to Community
In repil how do you clear the screen when using java?
Profile icon
screwlosse

I know that you can use System.out.print("\f"); to clear a screen when using other java writing applications but it doesn't work on repil

Voters
Profile icon
SucharitaDesu
Profile icon
screwlosse
Comments
hotnewtop
Profile icon
XavierDD

One way is to use this code.

System.out.print("\033[H\033[2J"); System.out.flush();

Please Upvote my comment if this is helpful

Profile icon
theangryepicbanana

@XavierDD actually do \033[0;0H not \033[H

Profile icon
mat1

@theangryepicbanana 0;0 are the default arguments and do not need to be specified.

Profile icon
PAULHANNA

This works with Java code in a REPL.
@XavierDD

Profile icon
XavierDD

@PAULHANNA , thanks. Wasn't expecting for people to look at older stuff on here.