In Windows an application can register a system-wide keyboard hook. It is probably a lot easier than writing a keyboard driver, but still the hook callback function must reside in an DLL. It's been ages since I've been doing this kind of things
to in Windows, so the best I can offer is a MSDN link:
SetWindowsHookEx.
Edit: of course, this kind of things is platform specific, so if you're not on Windows, this is not going to help. If you're on Windows, you'll need to write the DLL (in C or C++ perhaps), but
you should then be able to use that code via JNI or JNA. It might be possible to call a Java method from the DLL, I believe, but I'm not sure on which
thread the DLL will be called. You might want to store the keypresses in the DLL and use Java thread to call the DLL and obtain the keypressess once in a while.
If you just want to register a global shortcut key, there is a different (and much better) Windows function for that, that function even prevents application to register the same global shortcut.