Turning echo off in Java

Discussion in 'Java' started by ctippur@gmail.com, Jul 12, 2005.

  1. Guest

    Hi all,

    I would like to prompt the user for a password and turn off echoing
    what the user inputs ("stty echo off" command in unix). Is this
    possible in Java?
    I really appreciate any input.

    Thanks,
    Shekar Tippur
     
    , Jul 12, 2005
    #1
    1. Advertising

  2. Brzezi Guest

    wto, 12 lip 2005 o 21:29 GMT, napisa³(a):

    > I would like to prompt the user for a password and turn off echoing
    > what the user inputs ("stty echo off" command in unix). Is this
    > possible in Java?
    > I really appreciate any input.


    http://www.google.com/search?q=java hiding password

    check one of the links on top of the results...

    Pozdrawiam
    Brzezi
    --
    [ E-mail: ][ The wise man seeks everything in ]
    [ Ekg: #3781111 ][ himself; the ignorant man tries to get ]
    [ LinuxUser: #249916 ][ everything from somebody else. ]
     
    Brzezi, Jul 12, 2005
    #2
    1. Advertising

  3. Tim Slattery Guest

    wrote:

    >Hi all,
    >
    >I would like to prompt the user for a password and turn off echoing
    >what the user inputs ("stty echo off" command in unix). Is this
    >possible in Java?


    Huh? This is a programming language, not an OS shell. It doesn't write
    anything out unless you tell it to.

    --
    Tim Slattery
     
    Tim Slattery, Jul 12, 2005
    #3
  4. Tim Tyler Guest

    Tim Slattery <> wrote or quoted:
    > wrote:


    > >I would like to prompt the user for a password and turn off echoing
    > >what the user inputs ("stty echo off" command in unix). Is this
    > >possible in Java?

    >
    > Huh? This is a programming language, not an OS shell. It doesn't write
    > anything out unless you tell it to.


    It does when reading characters on the command line.

    I think the OP is looking for:

    http://java.sun.com/features/2002/09/pword_mask.html
    --
    __________
    |im |yler http://timtyler.org/ Remove lock to reply.
     
    Tim Tyler, Jul 12, 2005
    #4
  5. Tim Tyler coughed up:
    > Tim Slattery <> wrote or quoted:
    >> wrote:

    >
    >>> I would like to prompt the user for a password and turn off echoing
    >>> what the user inputs ("stty echo off" command in unix). Is this
    >>> possible in Java?

    >>
    >> Huh? This is a programming language, not an OS shell. It doesn't
    >> write anything out unless you tell it to.

    >
    > It does when reading characters on the command line.
    >
    > I think the OP is looking for:
    >
    > http://java.sun.com/features/2002/09/pword_mask.html



    It's entirely possible that the OP was looking for something non-command
    line based, but didn't know how to ask for it in swing/awt/etc.

    But in any case, I think that the solution you provided is both clever *and*
    hysterical!

    You gotta love the heroic leaps of effort that you can find here and there.



    --
    Puzzle: You are given a deck of cards all face down
    except for 10 cards mixed in which are face up.
    If you are in a pitch black room, how do you divide
    the deck into two piles (may be uneven) that each
    contain the same number of face-up cards?
    Answer (rot13): Sebz naljurer va gur qrpx, qrny bhg
    gra pneqf naq syvc gurz bire.
     
    Thomas G. Marshall, Jul 13, 2005
    #5
  6. Tim Tyler Guest

    Thomas G. Marshall <> wrote or quoted:
    > Tim Tyler coughed up:
    > > Tim Slattery <> wrote or quoted:
    > >> wrote:


    > >>> I would like to prompt the user for a password and turn off echoing
    > >>> what the user inputs ("stty echo off" command in unix). Is this
    > >>> possible in Java?
    > >>
    > >> Huh? This is a programming language, not an OS shell. It doesn't
    > >> write anything out unless you tell it to.

    > >
    > > It does when reading characters on the command line.
    > >
    > > I think the OP is looking for:
    > >
    > > http://java.sun.com/features/2002/09/pword_mask.html

    >
    > It's entirely possible that the OP was looking for something non-command
    > line based, but didn't know how to ask for it in swing/awt/etc.


    The URL covers that too:

    ``If you wish to provide a graphical login dialog box for your
    application, you can use the AWT's TextField class, which is a text
    component that allows editing of a single line of text. To mask the
    password field, use the setEchoChar method. For example, to set the
    echo char to an asterisk, you would do the following:

    TextField password = new TextField(8);
    password.setEchoChar('*');''

    There's also a Swing version.

    > But in any case, I think that the solution you provided is both clever *and*
    > hysterical!


    It's a real problem for those writing command line tools in Java.

    Echoing passwords to the screen is simply not normally acceptable.

    It's good that there's a way around the problem - even if it is ridiculous.
    --
    __________
    |im |yler http://timtyler.org/ Remove lock to reply.
     
    Tim Tyler, Jul 13, 2005
    #6
  7. On 12 Jul 2005 12:29:38 -0700, wrote:
    > I would like to prompt the user for a password and turn off echoing
    > what the user inputs ("stty echo off" command in unix). Is this
    > possible in Java?


    Does this help?

    http://groups-beta.google.com/group/comp.lang.java.programmer/msg/a132c7feda18187a

    Nothing is preventing you from running stty from within your application.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Jul 13, 2005
    #7
  8. Gordon Beaton wrote:
    > On 12 Jul 2005 12:29:38 -0700, wrote:
    >> I would like to prompt the user for a password and turn off echoing
    >> what the user inputs ("stty echo off" command in unix). Is this
    >> possible in Java?

    >
    > Does this help?
    >
    >

    http://groups-beta.google.com/group/comp.lang.java.programmer/msg/a132c7feda18187a
    >
    > Nothing is preventing you from running stty from within your
    > application.


    Only that it's not exactly portable... :)

    robert
     
    Robert Klemme, Jul 13, 2005
    #8
  9. On Wed, 13 Jul 2005 12:21:32 +0200, Robert Klemme wrote:
    > Only that it's not exactly portable... :)


    No such claims were made, however I'm confident that it's portable
    enough for the OP!

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
     
    Gordon Beaton, Jul 13, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Santosh

    Turning Off ASPSession Objects

    Santosh, Jun 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    519
    George
    Jun 15, 2004
  2. DC Gringo
    Replies:
    2
    Views:
    6,478
    DC Gringo
    Nov 18, 2004
  3. Chris

    Newbie Turn off Echo in C

    Chris, Oct 13, 2003, in forum: C Programming
    Replies:
    19
    Views:
    2,703
    Wolfgang Riedel
    Oct 16, 2003
  4. Replies:
    4
    Views:
    320
    osmium
    Aug 15, 2006
  5. Jacklty Lam

    How to turn off input echo in irb?

    Jacklty Lam, Aug 18, 2006, in forum: Ruby
    Replies:
    4
    Views:
    211
    Thaddeus L Olczyk
    Aug 19, 2006
Loading...

Share This Page