Are you running your application from an
IDE? From the
documention
System.console will only exist If the virtual machine is started from an interactive command line without redirecting the standard input and output streams
This means that System.console will not exist when your application is started by another process, which typical IDEs do.