wood burning stoves
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
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Retrieve password from console" Watch "Retrieve password from console" New topic

Retrieve password from console

Ketul Parikh

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 :


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

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
It's not a secret anymore!