weardstuff
weardstuff

Reputation: 807

Get global keyboard input with Java

How can I get what is being inputed in any program outside my java program.. Is there a way ? For example, I'm running my java program then I start typing in notepad, and I can see with my java program what is being typed.

Upvotes: 1

Views: 3348

Answers (3)

Alex Barker
Alex Barker

Reputation: 4400

There is a library to handle native keyboard and mouse control: http://code.google.com/p/jnativehook/

Upvotes: 0

Stephen C
Stephen C

Reputation: 719336

You cannot do this in pure Java. At some point, it will involve talking to an external application or a native library, and will be platform specific in either case.

Upvotes: 1

AbstractProblemFactory
AbstractProblemFactory

Reputation: 9811

The term you should looking for is Keyboard hooks, here is example using WinApi http://www.codeproject.com/KB/DLL/keyboardhook.aspx

Upvotes: 2

Related Questions