Sachverstand2 AT geocities.com:

Class Clrscr for Java

does clrscr like in Turbo Pascal


Class Clrscr

Users of headless (aka windos) environnenemts maybe must change "clear" to "cls".
import java.io.*;

public class Clrscr {

/* obviously, must
    - get runtime environnenent
    - execute a shell command, which results in a process
    - snatch the process' output into a StreamReader
    - buffer that in BufferedReader
    - and throw it onto the screen.
  Use Linux and have fun!!
*/
public static void clrscr(){
    try{
      Runtime rt=Runtime.getRuntime();
      Process p=rt.exec("clear");             // maybe must change to "cls"
      InputStream stdout=p.getInputStream();
      InputStreamReader isr=new  InputStreamReader (stdout);
      BufferedReader br=new BufferedReader(isr);
      String line=null;
      while ((line=br.readLine()) != null)
        System.out.println(line);
    }catch (Exception e){
      e.printStackTrace();
    }
  }
}

Class ClrscrTester

Almost surely, you will get better ideas to use Clrscr, but this one works...
public class ClrscrTester {
  public static void main (String[]args){
    System.out.println ("Clrscr Tester, sachverstand2, today");
    Clrscr.clrscr();
    for (int i=0;i<99;i++){
      for (int j=0; j<(int)(Math.random()*9);j++){
        System.out.println ("Clrscr Tester, sachverstand2, today");
      }
      Clrscr.clrscr();
    }
  }
}
1