hello all how can i clear the DOS screen through java program i hava search so many web site but i can't found the proper ans. thanx in advance [:)]
Use Jansi
Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
Steps:
1. Download the jansi-1.6.jar
2. Code to test jansi api.
import org.fusesource.jansi.*;
public class Test
{
public static void main(String []args)
{
AnsiConsole.systemInstall();
Ansi ansi=Ansi.ansi();
System.out.println(ansi.eraseScreen());
AnsiConsole.out.println(ansi.bg(Ansi.Color.RED) + "Hello");
}
}
3. Compile and run
>javac -cp .;jansi-1.6.jar Test.java
>java -cp .;jansi-1.6.jar Test
__avd
Posting Genius (adatapost)
8,736 posts since Oct 2008
Reputation Points: 2,141
Solved Threads: 1,262
Skill Endorsements: 50
shre: this thread hasn't been answred/ followed for almost a year, I think the OP (who asked the question over two years ago) by now has his/her answer or doesn't really care anymore.
stultuske
Industrious Poster
4,366 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 23