Uruchmienie cls w Windows (mam 8.1) mi nie działa. A jak pisze w cmd to mi wypisuje "Hallo word !"
i nie czyści.
Kod:
import java.io.Console;
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws InterruptedException, IOException {
System.out.println("Hallo word !");
Thread.sleep(1000);
clearConsole();
}
public final static void clearConsole()
{
try
{
final String os = System.getProperty("os.name");
if (os.contains("Windows"))
{
Runtime.getRuntime().exec("cls");
}
else
{
Runtime.getRuntime().exec("clear");
}
}
catch (final Exception e)
{
}
String x = new Scanner(System.in).nextLine();
}
}