Author
How can I clear the screen in CMD
Jahed Hossain
Greenhorn
Joined: Nov 30, 2012
Posts: 4
posted Nov 30, 2012 21:53:41
0
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.
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
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
Joined: Nov 30, 2012
Posts: 4
posted Nov 30, 2012 23:46:55
0
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
Bartender
Joined: Oct 14, 2005
Posts: 16483
What screen?
Peter Johnson
author
Bartender
Joined: May 14, 2008
Posts: 5536
posted Dec 01, 2012 20:19:49
0
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
JBoss In Action
Martin Vajsar
Bartender
Joined: Aug 22, 2010
Posts: 2329
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).
subject: How can I clear the screen in CMD