Typed data is not taken from the command line and made available from the standard in file descriptor until the return button is pressed. Instead, we can only grab complete lines. That leaves us with few alternatives. Unfortunately, most of the solutions require us to dive into native code or employ a GUI frontend. Instead, use a graphical frontend.
Swing provides for protected text fields.
Of course, that approach is useless if you plan to deploy on a terminal or another nongraphical environment. Forget writing that piece of your application in Java. Second, you'll need to encrypt the password since it may pass over the network. Write your own JNI command line reader and call it from your code, thus bypassing the input stream. Again, you'll need to recompile your library for each platform.