[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Emulating the LINUX  pass interface

Posted on 2002-06-18
3
Medium Priority
?
226 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 640 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month19 days, 23 hours left to enroll

872 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