package common; public class HidePasswordFromCommandLine extends Thread { public boolean stopThread = false; public void run() { while(!stopThread) { System.out.print("\b "); try { sleep( 1 ); } catch(InterruptedException e) { } } System.out.print("\b"); //removing the last * which was caused by the enter } }