0

I had already searched about clearing the screen in java console, and some suggest to use

Runtime.getRuntime().exec("cls");

to clear the screen, but it doesn't clear it at all. It just gives a runtime error

Exception in thread "main" java.io.IOException: Cannot run program "cls": CreateProcess error=2

Can somebody please explain why it isn't working (and yes, I'm in windows). Please dont suggest things like "you shouldnt clear screen" or suggest another way of clearing the screen, I just want to know why this code will give me an error, despite that I'm in Windows.

Many thanks in advance!

imaginate
  • 49
  • 10

0 Answers0