File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Moving the cursor on the console

 
Aiman Ashraf
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a simple console shell. It runs in an infinite loop and expects user to enter commands.

This places the cursor before PROMPT>> not after it. Is there some way to place it after PROMPT>>
This seems tricky because System.in and System.out are different streams.
But it must be simpler than it seems (I hope)
 
Kalabaw moo
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't have any problem here. You should use .equals() or .equalsIgnoreCase() of the String class if you're going to compare the contents of the String.

 
Aiman Ashraf
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right.
But that does not solve my original problem. Any ideas?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code unchanged ran all right on my PC, using OpenSUSE 11.1. I had the cursor in the correct place. What sort of terminal are you using?
 
Aiman Ashraf
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am testing it on Windows but it will finally run on a *nix machine. So I guess I should be fine. Thanks for the info.
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On my Windows XP machine it works as you want it, with the cursor after the >>.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic