문제

My title basically tells my goal. I would like to get some sort of keyboard input, be it an event or just plain text, using java in a headless environment. I believe there is a file in /dev that registers all keyboard events, but i don't know exactly the file name, nor if there is any special encoding around the file to read from it.

도움이 되었습니까?

해결책

You probably mean "text-only" rather than "headless", since you're apparently looking for interactive input. If using standard input isn't good enough, consider using a curses library like JCurses. You could theoretically use the /dev/eventX files, but you're going to run into lots of permissions and contention problems, and your program will be 100% non-portable.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top