如何在 Eclipse 中执行/打印一些语句后清除控制台。我用过 flush() 但没有用。只是发布示例代码。
System.out.println("execute ");
System.out.println("these set of lines ");
System.out.println("first");
Thread.sleep(2000); // just to see the printed statements in the console
System.out.flush(); // it is not clearing the above statements
最佳答案
Eclipse 控制台不支持clear screen 和其他 ANSI 转义序列 的解释为此需要。此外,ANSI Escape in Console Eclipse 插件不支持清屏。
在即将于2019年12月18日发布的Eclipse IDE 2019-12 (4.14)中,对反斜杠(\b
) 和回车 (\r
) 字符可以在首选项中启用(参见 Eclipse 4.14 - New and Noteworthy - Control character interpretation in Console View ):
关于java - 如何清除 Java 中的控制台 - Eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37301530/