質問

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