I am in need to capture the global keystrokes. Even my java program is not is focus i want that the key pressed must be known to my java program. Like if my program is not in focus and I hit the F12 key, my java program window pop up.
I google this and found that I can use JNI or JNA for such purpose. JNA a bit easy than JNI.
Now I don't have any idea where to start. I didn't found any resource useful to my needs. Does someone have any link or resource where I can get a dummy code for such purposes or any useful tutorial ?
That's called a "keystroke logger". A program which does that can be used to keep track of what your kids are doing on the computer, or to capture the user's credit card number and send it to Russian hackers, or a variety of similar things. Anyway you're going to be using APIs for whatever operating system you're thinking of and calling them via JNA from some language other than Java. You should be able to find loads of keystroke logging code on the web but make sure that any code you download is legitimate and doesn't contain features that can be misused.