Clearing the dos screen using java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Clearing the dos screen using java

Hybrid View

  1. #1
    seema mani Guest

    Clearing the dos screen using java


    hi
    I want to clear the dos screen using java.
    I saw 2 solutions on the net(given below) , but both did not work. Can someone
    advise how I can go about doing this ? I'm
    working on Windows2000.

    Thanks in advance.

    Seema

    1. char esc = 27; // ESC code
    String clear = esc + "[2J" // note case
    System.out.print(clear); // Dos screen should be cleared

    2. Runtime.getRuntime().exec( "cmd.exe /c cls" ) ;



  2. #2
    Paul Clapham Guest

    Re: Clearing the dos screen using java

    for (int i=0; i<24; i++) System.out.println("");

    (Replace 24 by some other number if your DOS screen has more than 24 lines.)

    If you find you are spending a lot of time trying to make your DOS input and
    output look nice, that is a hint that you should be using a GUI instead.

    PC2

    "seema mani" <seemamani@rediffmail.com> wrote in message
    news:3bd7f043$1@news.devx.com...
    >
    > hi
    > I want to clear the dos screen using java.
    > I saw 2 solutions on the net(given below) , but both did not work. Can

    someone
    > advise how I can go about doing this ? I'm
    > working on Windows2000.
    >
    > Thanks in advance.
    >
    > Seema
    >
    > 1. char esc = 27; // ESC code
    > String clear = esc + "[2J" // note case
    > System.out.print(clear); // Dos screen should be cleared
    >
    > 2. Runtime.getRuntime().exec( "cmd.exe /c cls" ) ;
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center