Hello everyone,
I know this question has been asked before but it is possible to write a keylogger in java? Before assumptions are made I'm not trying to hack anyone or do anything illegal. I simply have a team project in my data structures class and I am an aspiring computer forensic scientist. I'm not looking for the program to hide in Windows processes I just want to know if it is possible to get the basic functionality of a keylogger in this language.

8 Years
Discussion Span
Last Post by peter_budo

... sounds like you have to attack a database, use dictionary, social engineering maybe, a lot of queries....

Edited by endsamsara: n/a


Java lacks the low level operating system hooks to do this, and that's by design.
You'd need to use JNI or JNA to do the actual sneaky stuff and pass that information to a Java process.


but it is possible to write a keylogger in java?

I haven't done it, but I have seen someone create a program that included one before. It is much more common with other languages as mentioned above.


yes it's possible

package keylogger;

import java.keylogger.*;

public class Keylogger 
  while (PC.windows.on.getState == true)
    if (keyPressed.equals("true"))

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

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.