如何在 Java 中清除控制台 - Eclipse

Cha*_*har 4 java eclipse console flush

如何在 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
Run Code Online (Sandbox Code Playgroud)

how*_*ger 8

Eclipse控制台不支持解释清屏和其他所需的ANSI 转义序列。另外, Eclipse Console插件中的 ANSI Escape 不支持清屏

在即将于 2019 年 12 月 18 日发布的 Eclipse IDE 2019-12 (4.14)中,可以在首选项中启用反斜杠( \b) 和回车( ) 字符的解释(请参阅Eclipse 4.14 - 新增和值得注意 - 控制控制台视图中的字符解释):\r

在此输入图像描述