S
schnorpel
Gast
Ich möchte ein Programm für Konsole schreiben. Dabei möchte ich ab und den Bildschirm leeren. Wie mach ich sowas?
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
wenn es nur für windows sein soll, könntest du Runtime.exec("cls") benutzen.
String sys;
sys=System.getProperty("os.name");
//so nun kommt die entsprechende abhandlung
if(sys.indexOf("Windows")!=-1){
//windows anhandlung
}
//weitere betriebssystemabfragen
import java.io.*;
class Test
{
public static void main(String[] args)
{
String pfad = "C:\\WINNT\\SYSTEM32\\cmd.exe";
String sys;
sys = System.getProperty("os.name");
//so nun kommt die entsprechende abhandlung
if(sys.indexOf("Windows 2000")!= -1)
{
System.out.println(sys);
try
{
Runtime clean = Runtime.getRuntime();
clean.exec("cls");
}
catch (IOException e)
{
System.err.println(e.toString());
}
}
}
}