Solved

Emulating the LINUX  pass interface

Posted on 2002-06-18
3
206 Views
Last Modified: 2010-03-31
Hi,
I want to do something like the password's Linux mode.
For example under the Shell or Ms-dos mode I want the user to be able to write characters but at the screen nothing should be echoed (or printed).

Something like:
====
Username: someone
PassWord:
====

And after the password the characters should not be visible.

Thank you in advance
0
Comment
Question by:pouli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
heyhey_ earned 160 total points
ID: 7092166
http://java.sun.com/people/linden/faq_d.html

(Sect. 16) How can I accept a password from the console without echo?

 When you want to pick up a password from the console, you don't want  to have the characters echoed as the user types them.

There is no way to accomplish this in Java using console I/O. You have an easy approach and a hard approach. The easy approach is to use the AWT (Textfield) or Swing (JPasswordField). The harder approach is to write native code to disable and enable echoing to the console.

Note that the obvious use of Process process = runtime.exec("stty -echo"); will not work because it turns off echo in the spawned child process not the process running the JVM.
0
 

Author Comment

by:pouli
ID: 7098600
Thank you Heyhey :)

You gave me more than I wanted with your URL.
0
 

Author Comment

by:pouli
ID: 7104354
I forgot to give you the points :-)
I give you some more points from previous questions were I was a bit unfair :)
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question