在 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
原文由 Chandra Shekhar 发布,翻译遵循 CC BY-SA 4.0 许可协议
Eclipse 控制台不支持 对 清晰屏幕 的解释以及为此所需的其他 ANSI 转义序列。此外, 控制台 Eclipse 插件中的 ANSI Escape 不支持 _清屏_。
在即将于2019年12月18日发布的Eclipse IDE 2019-12(4.14) 中, 反斜杠(
\b
)和 回车(\r
)字符的解释可以是在首选项中启用(请参阅 Eclipse 4.14 - New and Noteworthy - Control character interpretation in Console View ):