I would like to make use of java.io.Console. I am trying to do so by invoking System.console(). This works..some of the time.
This is fine when I run my program like so:
java classn
However, I would like to read standard input from a file named input.in. When I try to do so via:
java classn < input.in
I receive a null pointer exception:
Exception in thread "main" java.lang.NullPointerException
at classn.main(classn.java:9)
Is there a fix so I can use Console along with input from a fix? I realise why it's returning null, I would just like to know if there's a way to hook the Console into what's being passed in via a file.