How to write a java program that runs in background but still can detect any key press from the keyboard (with the corresponding keycode)

5 Years
Discussion Span
Last Post by JamesCherrill

@Taywin.. you are right..

It may be keylogger..but leave that aside...

I have the same question from long time.. How can we make a java program listen to our keystrokes without any window.
As all of us know we can add keylistener to frame or any window. But is it POSSIBLE in java to make it listen the keystrokes without registering to frame or any component..(intention may be to make keylogger or whatever . its secondary thing)..

I know that it is NOT possible..(as far as i know)..
Are there any nerds who says POSSIBLE....

Waiting for replies......

Edited by harinath_2007: n/a


My favourate language doesn't help me to make Keylogger..
Should i shift to other language just to make a silly keylogger..
No way.:)
But i'll look out traditional languages(C/C++)..:)


Correct, the behavior is keylogger but Java is too obvious to make a keylogger. You need a lower level language for it. C/C++ would be good for. Though, it would be OK if you are curious and want to learn, but nothing else ;)


And even were it possible, it'd be unethical and possibly illegal for anyone to help you write one. Keyloggers are used almost exclusively in malware, thus the only conclusion we can come to is that you're trying to write malware.

don't see why this should be downvoted. simple facts.

Well, I was googling the same, but in my case it is that I want my program to catch a special keyboard combination triggering an event (such as in teamspeak where you have to press a special key-combination to make it mute your microphone etc...)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.