Easy question here...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anthony_Lew
Posted On:   Sunday, March 31, 2002 09:21 PM

My question is: how do I make the equivalent java system call to clear screen as done in C++ using " system("cls"); "? Thankyou.

Re: Easy question here...

Posted By:   neal_ravindran  
Posted On:   Monday, April 1, 2002 07:07 AM

public class ClearScreen{

public static void main(String args[]){


for( int i = 0; i < 1000; i++ ){//1000? just my idea...you could use say, 50

System.out.println();

}



}


}



Poor man's soln...but you should try JNI with the C function clrscr().

The following however did not work for me...and have no clue why(it should when used inside main!)

try{

Runtime r = Runtime.getRuntime ();

Process p = r.exec ("cmd /c cls");

}


catch(IOException e){


}

About | Sitemap | Contact