Solved

Emulating the LINUX  pass interface

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

729 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