Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Runtime.getruntime.exec(“cls/clear”);不在Windows中工作以清除控制台_Java_Console - Fatal编程技术网

Java Runtime.getruntime.exec(“cls/clear”);不在Windows中工作以清除控制台

Java Runtime.getruntime.exec(“cls/clear”);不在Windows中工作以清除控制台,java,console,Java,Console,我曾多次尝试清除控制台,并编写了这个Runtime.getruntime.exec(“cls”)但未得到任何结果,表示控制台未在窗口中被清除系统。out.print(“\b”)可能会起作用。打印的每个字符一个\b System.out.print("Foo"); System.out.print("\b\b\b"); System.out.print("Bar"); 这印的是“酒吧” String foo=“foo”; 系统输出打印(foo); 对于(int i=0;i

我曾多次尝试清除控制台,并编写了这个Runtime.getruntime.exec(“cls”)但未得到任何结果,表示控制台未在窗口中被清除

系统。out.print(“\b”)
可能会起作用。打印的每个字符一个
\b

System.out.print("Foo");
System.out.print("\b\b\b");
System.out.print("Bar");
这印的是“酒吧”

String foo=“foo”;
系统输出打印(foo);
对于(int i=0;i
使用循环得到相同的结果。

System.out.print(“\b”)
可能会起作用。打印的每个字符一个
\b

System.out.print("Foo");
System.out.print("\b\b\b");
System.out.print("Bar");
这印的是“酒吧”

String foo=“foo”;
系统输出打印(foo);
对于(int i=0;i

使用循环得到相同的结果。

您是否尝试过使用
Runtime.getruntime.exec(“cls”)??
Runtime.exec()
将在单独的进程中执行指定的命令。。。与您的Java程序正在运行的情况不同…那么如何清除控制台?您是否尝试过使用
Runtime.getruntime.exec(“cls”)??
Runtime.exec()
将在单独的进程中执行指定的命令。。。与Java程序正在运行的情况不同…那么如何清除控制台?