Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to clear the consol after input java

public class ClearScreen{
    public  static void main (String [] args){
        System.out.println("Hello World");
        ClearConsole();
    }

    public static void ClearConsole(){
        try{
            String operatingSystem = System.getProperty("os.name") //Check the current operating system
              
            if(operatingSystem.contains("Windows")){        
                ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "cls");
                Process startProcess = pb.inheritIO.start();
                startProcess.waitFor();
            } else {
                ProcessBuilder pb = new ProcessBuilder("clear");
                Process startProcess = pb.inheritIO.start();

                startProcess.waitFor();
            } 
        }catch(Exception e){
            System.out.println(e);
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: if en une seul ligne java 
Java :: Fomating .json 
Java :: rstudio boxplot coloring 
Java :: javalin pom 
Java :: error message pushes button down 
Java :: Java search() Method 
Java :: labelled for loop in java 
Java :: java print color in console eclipse 
Java :: string expression execution for java 
Java :: how to use advanced math in java 
Java :: how to know when user is done typing android 
Java :: mock dynamodb unit 
Java :: converting amount into millions nad billions Java 
Java :: java.lang.number is interface or abstract class 
Java :: set bean properties 
Java :: what is the use of the tolowercase in java 
Java :: linux mint switch language 
Java :: @column spring boot jpa 
Java :: java.lang.noclassdeffounderror: failed resolution of: lorg/apache/http/protocolversion; 
Java :: spigot scoreboard objective 
Java :: spigot wolf death message 
Java :: day of week integer to name of day in java 
Java :: Java remove element in a array - set to null 
Java :: call to jdbc template each class not by super 
Java :: exit for loop java stack overflow 
Java :: darkhub 
Java :: sorting boolean array with prime index 
Java :: java casting method 
Java :: logger output to console twice java 
Java :: minecraft 21w14a bugs 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =