0

I need to clear the console, for both windows and Linux, though Mac would be helpful.

I also need to delete the latest individual line.

I looked through multiple forums and none of them worked... Can someone please show something that actually works?? Rather then marking as duplicate.

I tried these to clear the screen:

Runtime.getRuntime().exec("cls"); // and "clear" too 

System.out.flush(); 

private final String ANSI_CLS = "\u001b[2J";

System.out.print('\u000C');

System.out.println("\f");

final static String ESC = "\033[";
System.out.print(ESC + "2J"); 

But none of these seem to work.. Do I need to add a special library like LWJGL to do this?

Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0