Hallo Freunde
Wenn ich versuche mit Hilfe von exec() den Befehl "cls" (ClearScreen) auf Dos-ebene auszuführen, bekomme ich folgende Fehlermeldung.
java.io.IOException: CreateProcess: cls error=2
Kann mir jemand sagen was ich da falsch mache!!!!
Wenn ich versuche mit Hilfe von exec() den Befehl "cls" (ClearScreen) auf Dos-ebene auszuführen, bekomme ich folgende Fehlermeldung.
java.io.IOException: CreateProcess: cls error=2
Kann mir jemand sagen was ich da falsch mache!!!!
Code:
public class Animation
{
public static final void main( String[] args )
{
int i = 0;
while(true)
{
Animnation(i);
i++;
if(i == 3)
i=0;
try
{
Thread.sleep(100);
Runtime.getRuntime().exec("cls");
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e)
{
// TODO Auto-generated catch block
System.out.println(e.toString());
}
}
}
public static void Animnation(int i)
{
switch(i)
{
case 0:
{
System.out.println("|\b");
break;
}
case 1:
{
System.out.println("/\b");
break;
}
case 2:
{
System.out.println("-\b");
break;
}
case 3:
{
System.out.println("\\\b");
break;
}
default:
{
break;
}
}
}
}