且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

命令在java中清除屏幕

更新时间:2023-10-27 18:12:04

想要的是清除屏幕并将光标移动到原始位置。对于那个尝试:

I think what the OP wants is to clear the screen and move the cursor to the home position. For that try:

        final String ANSI_CLS = "\u001b[2J";
        final String ANSI_HOME = "\u001b[H";
        System.out.print(ANSI_CLS + ANSI_HOME);
        System.out.flush();