This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieve password from console