?
Solved

Emulating the LINUX  pass interface

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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 will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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