I have a problem with my java program. I'm trying to build an internet radio client for my server machine. The problem is how I'm gonna give input to the program. The server box does not have a monitor, so I'm gonna have to give the input through keyboard "blind". For this reason it would be great if pressing only one key would do the trick instead of pressing the key and then inputting it with enter.
So, the question is: can you monitor the key presses in the normal console window like you can in swing components with KeyListener? If yes, how? If no, is there a workaround? My server has no graphical interface installed so it can't include swing or any other graphical UI component. Any kind of working solution goes since the only thing the interface part of the program has to do is detect the key presses, nothing else.
Edit: My server runs a Red Hat Linux.
Thanks for your help. [ May 19, 2005: Message edited by: S. Lohi ]
Joined: Dec 29, 2004
You might try System.in.read(), but I'm not sure if it will work without pressing enter.
My recommendation would be to control it over the network. Have it open a socket and listen, then you can send it simple commands from one of your other machines.