I have a Java program that runs in the background without any UI.
Can it listen to keyboard input?
You can't do this, unless you use some native magic.