Unbuffered Standard Input in Java Console Applications

Say you’re writing a Java console application and want to handle user input in an unbuffered mode. That’s said you don’t want the user to press Enter / Return after some typing – you want that every keyboard hit is delivered to your program immediately. Something similar is implemented in metracer for closing the program when user presses ‘q’.  Let’s see how to implement this in Linux.