Computing.Net > Forums > Programming > Java console help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java console help

Reply to Message Icon

Name: AmericanSlon
Date: October 28, 2004 at 10:11:59 Pacific
OS: win xp sp 2
CPU/Ram: Athlon XP 2800+
Comment:

How do you clear console screen in Java?
If there is no neat function for that , then how do you position cursor in the given position in console screen.

Thanx in advance




Sponsored Link
Ads by Google

Response Number 1
Name: Dr. Nick
Date: October 29, 2004 at 19:07:26 Pacific
Reply:

Google really does work!

Try this query. The first two results answer both your questions, and if that's not quite what you're looking for I bet it's in another result.


0

Response Number 2
Name: AmericanSlon
Date: October 31, 2004 at 09:46:02 Pacific
Reply:

NO s--- MAN IT WORKS!

If I have found the answer in Google I wouldnt be asking it here. So if its too hard for you too answer dont bother replying like that. I visited those sites and I have no clue what does it say there. I suck at java and I asked it here because I hoped to get clearlier answer.


0

Response Number 3
Name: Dr. Nick
Date: October 31, 2004 at 22:31:08 Pacific
Reply:

NO s--- MAN IT WORKS!

I'm glad to see we're in agreement!

...I asked it here because I hoped to get clearlier answer.

An easy way to clear the console, which will work regardless of the platform is to simply "brute force" it:

for (int i=0; i<15; i++)
    System.out.println("\n");

The only issue you might have is how many newlines to print, but printing is "cheap" enough that it's not a big deal. It is a lot less expensive though to print multiple newlines inside each print statement rather than calling println() many times (ie: double the number of '\n's and cut the number of loop iterations in half for better performance).

As far as placing the cursor at a specific place, dunno about that. Setting a horizontal position is easy enough, but I don't know about a vertical one that's platform independent and doesn't involve clearing the screen.


0

Response Number 4
Name: AmericanSlon
Date: November 1, 2004 at 20:32:35 Pacific
Reply:

Thanx man,

I figured the way you are describing my self though. And its not how I want it though. I actually want everything to desappear from console rather then move up... Thats why I wanted to know how to move cursor to a given postion so I can move it up and system.out.println() over the other stuff. But well I can see its a big problem in Java and it doesnt matter now anyways.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Java console help

Java RMI ??? Help... www.computing.net/answers/programming/java-rmi-help/6895.html

Java Program Help www.computing.net/answers/programming/java-program-help/5365.html

Java programming help www.computing.net/answers/programming/java-programming-help/9672.html