Skip to content
← Back to Community
clear console in repl.it Java
Profile icon
Camilo_ReneRen1

Hi!
Can anybody help me to clear console in a Java program at repl.it?
Please!

Comments
hotnewtop
Profile icon
utgtest

There is a a much better way to do this:

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

Profile icon
braxtondb

@utgtest This works! Thanks!

Profile icon
SpencerL26

@utgtest Thank you so much, I might be a bit late to the party but this solution is very helpful :)

Profile icon
CSharpIsGud

Try outputting this \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n

It does not really clear the console but you wont be able to see any text that was there before you outputted them

Profile icon
PYer

@CSharpIsGud Yeah, I do that to with python. But a shorter way would be to do "\n"*100 :)

Profile icon
RyanRana

I do not believe it is possible but why would you need to any way?

Profile icon
BlueLightning42

Sorry clearing the console is only supported in python as of this moment

Profile icon
PYer

@BlueLightning42 Only with eval mode though. You have to import the replit module. You cannot do it in a .py file.