I was using readLine
of BufferedReader
to get input/new password from user, but wanted to mask the password so I am trying to use java.io.Con
I also ran into this problem when trying to write a simple command line application.
Another alternative to creating your own BufferedReader object from System.in is to use java.util.Scanner like this:
import java.util.Scanner;
Scanner in;
in = new Scanner(System.in);
String s = in.nextLine();
Of course this will not be a drop-in replacement to Console, but will give you access to a variety of different input functions.
Here's more documentation on Scanner from Oracle.