Paul Sauer Paul Sauer - 1 month ago 6
Java Question

Global KeyLogger

I have been searching for a while now for a library that allows me to know which Key-Event was pressed. But not in a focused program/text-field or anything else but as a process that runs in the background.
I'm not trying to write a keylogger but I want to create a program that lets me create shortcuts for key-combinations.

Dan Dan
Answer

You can achieve this using JNI and Global System hook. Global System hook applies a Key Logger to the whole computer and not the JVM therefore allowing you to capture key presses outside of the JVM.

An example implementation of it can be seen here