Solved

Emulating the LINUX  pass interface

Posted on 2002-06-18
3
174 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countX 22 70
wordcount challenge 11 76
recursion example 16 68
Groovy:unable to resolve class error 2 31
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 …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now