This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Moving the cursor on the console Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Moving the cursor on the console" Watch "Moving the cursor on the console" New topic
Author

Moving the cursor on the console

Aiman Ashraf
Greenhorn

Joined: Oct 11, 2009
Posts: 5
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

Joined: May 26, 2009
Posts: 61
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

Joined: Oct 11, 2009
Posts: 5
Yes, you are right.
But that does not solve my original problem. Any ideas?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38031
    
  22
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

Joined: Oct 11, 2009
Posts: 5
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

Joined: Oct 27, 2005
Posts: 19654
    
  18

On my Windows XP machine it works as you want it, with the cursor after the >>.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Moving the cursor on the console
 
Similar Threads
help needed with my while loop
Using percent Modulus to calculate total number of even numbers from user input
Scanner
Array Project Help
class CLASS and Scanner class