2

In a university project during the summer and in association with a keyboard maker, I have to create a study. This study should count the average number of key stroke and words that a normal user would type every day on his computer. Every week we will give a different keyboard to all users. (there are 100 users that will use their computer with the given keyboards during 2 months).

In order to achieve this study I need to create a program. This program will be installed on the computer of the 100 users. This program will be written in Java and should listen to the key strokes and save every single key stroke in an encrypted file. (then every day the content of this file will be saved in a database and we will be able to analyse all the data).

So at the moment I'm stuck because I don't know how to create a key listener. Indeed, I found several topics about key listeners but all of them work with a user interface. What I need is a key listener that run in background and capture all the key strokes.

Do you have any idea about how to do that?

bcsb1001
  • 2,834
  • 3
  • 24
  • 35
Mtoypc
  • 464
  • 1
  • 6
  • 24
  • 1
    http://stackoverflow.com/questions/12177416/java-key-listener-to-track-all-keystrokes – johmsp Jun 17 '16 at 16:02
  • Thank you very much. So according to what I see I'll need to interact with the operating system. So there is no way to make it cross platform ? – Mtoypc Jun 17 '16 at 16:09
  • `system-hook` only bundles the windows native interfaces needed to access the global keystrokes, but it doesn't say it would be impossible on unix / BSD systems. – Aaron Jun 17 '16 at 16:23
  • Ok thank you, I've got more work than I thought then :) – Mtoypc Jun 17 '16 at 16:33

1 Answers1

0

Nope, there is no way to capture keystrokes that way in pure Java. You'll need to interface with a native library as johmsp suggested. Which platforms your program will work on will depend upon the library you use.

Daniel O
  • 336
  • 2
  • 3
  • 8