• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clrscr() in JAVA ???

 
Prosenjit Banerjee
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello sirs,
Is there in methods built in JDK that will do the same task as clrscr() does in C++?
It not, can you write me a similar method, please ?
Thanks very much.
 
Mikael Jonasson
Ranch Hand
Posts: 158
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you could always just print a bunch of empty lines (like 30 or so). This will give the same efftekt I guess...
/Mike
 
Prosenjit Banerjee
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mr. Mikael Jonasson, but clearing the screen means not only clearing but also setting the cursor to the upper left position of the screen. What about that? Please suggest.
Thank you.
 
Prosenjit Banerjee
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone please suggest me, whether the above (setting the character mode cursor at a particular position)is possible??
Please tell me. It is URGENT
 
Steven YaegerII
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've no experience in your request, but I would think that the Windows API's would contain a CLS. You might check out JINI, to use the native C++ function.
I'd also post the same query in the Java in General(advanced) forum.
Good Luck
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13049
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the basic Windows DOS Command window does not emulate any specific cursor positioning algorithm I don't think there is a general way. If you were dealing with output to a terminal, or an X-windows display, etc. then there would be specific escape code sequences to position the cursor, etc etc. What sort of system are you trying to do this on?
Bill
 
Prosenjit Banerjee
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all who tried to answer me. But still I have no specific answer. Please help me.
As asked by Mr. William Brogden I am using Windows 98 and trying to run the program in the DOS shell.
Waiting for desired reply...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13049
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As near as I can tell there is no way to treat the MSDOS command prompt window in Win98 like a terminal with cursor positioning commands.

Bill

 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clearing the screen on a Windows system and clearing the screen on a Unix box would be completely different. This is VERY OS dependant. Java does not do stuff that is OS dependant. The solution is to do the clear screen in a native language and blend it in using JNI.
 
Prosenjit Banerjee
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for replying me. I think I got my answer. I have to use JNI. But since I do not know how to use it, I have wait some days more to learn it and then apply.
But I think Mr. William Brogden has an OS specific anwer. If really he has please let me know. I have already mentioned what kind of system I am using.
Thank you very much again.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Brogden:
As near as I can tell there is no way to treat the MSDOS command prompt window in Win98 like a terminal with cursor positioning commands.

Bill

I think he already said that he DID NOT have a way on Win98.
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3674
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to read this article. http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
What you need is the last part where the author shows how you can execute dos commands. It won't competely solve your problem but now have an idea to work on.
HTH,
Paul.
------------------
Get Certified, Guaranteed!
www.enthuware.com/jqplus

SCJP2 Resources, WebCompiler, Compare Mock Exam Results and More!
www.jdiscuss.com
Your guide to SCJD exam!
www.enthuware.com/jdevplus
[This message has been edited by Paul Anil (edited June 04, 2001).]
 
Junilu Lacar
Bartender
Pie
Posts: 6563
22
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick search on google.com for "ANSI cls" turned up these possible answers to your question
Junilu

[This message has been edited by JUNILU LACAR (edited June 04, 2001).]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13049
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool reference Junilu!
I wonder how much of the ANSI terminal control code standard is implemented. As I recall you could even set colors, but where to find a listing of the codes.....
Bill
 
Prosenjit Banerjee
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, finally I got the desired answer. Thank you so much Mr. Paul Anil and Mr. Junilu Lacar for the references offered.
I tried the following two codes in my MSDOS terminal under Win98.
Code #1 :
---------

Code #2 :
---------

I prefer the second code. Because it seems much faster than the first. But to make it working the ANSI device driver must be installed. I installed it by inserting the following line in my config.sys and then restarting the computer :
.
Thanks very much.
I LOVE JAVARANCH.COM.
 
Rashid Ali
Ranch Hand
Posts: 349
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What an informative thread is this. All the replies are really appreciated too much.
Keep helping the others.
Thanks
Rashid
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Similar Threads