aspose file tools*
The moose likes I/O and Streams and the fly likes Retrieve password from console Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Retrieve password from console" Watch "Retrieve password from console" New topic
Author

Retrieve password from console

Ketul Parikh
Greenhorn

Joined: Jul 17, 2009
Posts: 14
Hi All,

I have a requirement to take password from console.
For jdk 6 there is a way to get it :

System.console().readPassword()

But, my problem is that, I have to do it using jdk 5, is there any equivalent way of doing it.


KETUL
Peter Taucher
Ranch Hand

Joined: Nov 18, 2006
Posts: 174
That's not a simple task. You could mask the user input yourself (printing "\010*") or take use of os specific functions. Both ways have their weak points.

-> http://stackoverflow.com/questions/1108937/how-to-mask-a-password-in-java-5


Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
 
 
subject: Retrieve password from console