aspose file tools
The moose likes Beginning Java and the fly likes how to clear console in java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "how to clear console in java ?" Watch "how to clear console in java ?" New topic
Author

how to clear console in java ?

Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1291

hi ranchers,

Is there any method or class in java to clear console screen? like a DOS prompt "cls" is command is use to do this..

Thanks,


Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
dinesh Venkatesan
Ranch Hand

Joined: Oct 12, 2006
Posts: 134
Hi Saif,

In the FAQ section, you can find detailed techniques practiced for clearing the console.
Please check it out.

dinesh.
poorna prakash parvathala
Greenhorn

Joined: Dec 18, 2006
Posts: 20
Hi,
One way of doing is you can call the OS specific clear console command for example "CLS" for DOS/Windows using Runtime.exec().
but that is platform specific :-(


Poorna Prakash<br /> <br />SCJP 1.4 (90%), SCWCD (planning)
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
But: you should NEVER do that, NEVER assume you have the console to yourself.


42
Ranjeet Kr Rai
Greenhorn

Joined: Feb 05, 2011
Posts: 12

Is there no way to clear console in JVM
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 26710
Somebody has already said to look for our FAQ.
vinayak jog
Ranch Hand

Joined: Apr 01, 2011
Posts: 55

Java is platform independent langauge. Different Operating systems have thier own way of accesing console and clearing console. Java has no direct method for clearing console.

Using dos command like "cls" is one of the solution but it works only on windows. Similarly you need to use "clear" command for linux and so on..

Better not to use any of the above said methods lets stick conventional java
 
 
subject: how to clear console in java ?
 
Threads others viewed
How to clear Sytem console
Clear Screen Method in JAVA
Unable to open Applet in Firefox/Mozilla
Clearing console from java application
How to clear screen (clrscr) in java?
IntelliJ Java IDE