Andrzej Borucki wrote:In System.console().printf("something") is error, despite in Eclipse I check "Allocate console" in Common tab in Run/Debug configurations
It would be useful to know what the error is. Is it, for example, a NullPointerException?
I'm pretty sure that the "console" referred to in the tab you mentioned is Eclipse's console, not a Console object, which has only been around since 1.6. I also understand that some IDE's use a background Thread for it, which is incompatible with System.console().
My suggestion: look at the example code in the java.io.Console docs, and use that; and if it doesn't work in Eclipse, try running your program from the command line instead.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Joined: Aug 24, 2013
If I create runnable jar, it printf() OK, but with Eclipse IDE is java.lang.NullPointerException
How to write common code - System.console() for outside Eclipse and Eclispe console for inside IDE?