commands in java to clear the screen

后端 未结 11 854
一向
一向 2020-11-29 07:35

What command in Java will let you clear the console in a command-line application?

11条回答
  •  隐瞒了意图╮
    2020-11-29 08:14

    If none of the above solutions works for you( as in my case ), try this solution:

    new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
    

    I'm using Windows 8 and this solution worked for me. Hope it does to you as well. :)

提交回复
热议问题