问题
I want to handle os level events in java. I need to do is to perform some logic on key press. I find jni is used for this purpose but don't know how. I don't need to handle event on gui. my application will run on background and perform some logic on every key press.
回答1:
If you think using a GUI is overkill, I wouldn't consider using JNI which will be 10x harder. Even if you are confident in C, it can be tricky.
You are better off using a library which does what you want already like http://jline.sourceforge.net/
来源:https://stackoverflow.com/questions/12615714/os-level-event-handling