• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I clear the screen in CMD

 
Greenhorn
Posts: 11
Firefox Browser Windows Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Windows 7 and I'm wondering how I can clear the command line screen,
using java code, like normally you would write CLS for Command & Prompt.
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The CLS command works for me in Windows 7. What happens when you type CLS at the command line?

(Also I will move this to the General Computing forum since it isn't about Java.)
 
Jahed Hossain
Greenhorn
Posts: 11
Firefox Browser Windows Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:The CLS command works for me in Windows 7. What happens when you type CLS at the command line?

(Also I will move this to the General Computing forum since it isn't about Java.)



I'm looking for a statement or something you can write in java to clear the screen.
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What screen?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are going to have to invoke some Win32 API functions to do this for you. Which means you need to write a native library to access those functions. This might help:
http://support.microsoft.com/kb/99261?wa=wsignin1.0
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd say it should be also possible using either the Jansi, or perhaps JCurses library.

The Jansi library seems to provide platform independent way to do manipulate console output.

JCurses would allow you to create and manage your own console (that's way different from using stdout, but perhaps it might fit your needs too).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic