Questions tagged [jnativehook]

JNativeHook is an open source library to provide global listeners for keyboard and mouse events

WHat it is?

JNativeHook is an open source library to provide global listeners for keyboard and mouse events.

How it works?

JNativeHook uses a combination of platform dependent hooking techniques combined with JNI, in order to create low-level hooks that deliver the events to the JNativeHooks written in Java.

Related tags

  • for general questions about hooking low-level events and not necessaritly java specific
  • in combination with language independent tags when appropriate: ,
  • use for the .net equivalent

See also

58 questions
1
vote
1 answer

KeyEvent.getKeyText and NativeKeyEvent.getKeyText gives back different values

I have a question regarding a Java KeyListener. I use both Java's built in key listener in a JTextField and the NativeKeyListener of jnativehook, and unfortunately, they both give out different key codes. I think that it might be cause I have a…
SIMULATAN
  • 833
  • 2
  • 17
1
vote
0 answers

JAVA - Why JNativeHook doesn't work on Windows?

I am creating a simple key logger in JAVA so I use JNativeHook library to record keys typed. My program works properly on Ubuntu but when I try to start it on Windows, the following error appears : avr. 20, 2020 1:42:17 PM…
Hayato175
  • 21
  • 5
1
vote
0 answers

How to suppress F keys of other aplications

I created a Java application that uses GlobalScreen to addNativeKeyListener. (jnativehook library) When i press F5 it executes a code. Problem is that if i give focus to other applications it also executes funciton for the focused application. (for…
1
vote
1 answer

How do i correctly compile jnativehook on intellj?

i'm quite sure i have everything right but it just won't compile the example posted on the website Here's my POM.xml
jorma uotinen
  • 15
  • 1
  • 3
1
vote
1 answer

How to prevent or remove foreground text input from background Java process?

I am creating a background Java program that will take input from a USB-enabled NFC reader and perform an API request with the data found on it (a 10 digit number). However, the readers have no software of their own, and behave like a keyboard,…
Luke Redmore
  • 449
  • 3
  • 10
1
vote
1 answer

Java nativeKeyTyped method of JNativeHook library is not fired on Windows 10

I'm using JNativeHook for global keyboard listen, but the nativeKeyTyped method is never fired on windows 10. The nativeKeyPressed and nativeKeyReleased methods are always fired. All methods work perfectly well on linux. Can someone help me with…
araraujo
  • 613
  • 2
  • 8
  • 17
1
vote
0 answers

How to prevent other application with administrator rights from disabling hooks registered through JNativeHook?

I have a Java application running on Windows that registers mouse and keyboard hooks through the JNativeHook API (https://github.com/kwhat/jnativehook). My problem is that they are getting disabled by an external application with administrator…
1
vote
0 answers

MacOS native hook listener Java

we currently have a C# DLL used by a java application with JNI in Windows. It can get native listener hook from mouse, keyboard, get and replace text, get caret position and software info. I need the same for MacOS (High Sierra). I made some…
hugo411
  • 320
  • 1
  • 12
  • 29
1
vote
2 answers

Java AutoClicker with JNativeHook Runs infinitely

I have been trying to write this autoclicker with java for around 7 hours now. I wrote some of this based on other people's code, some by myself. I used JNativeHook to capture clicks in windows outside of Eclipse/the console. The idea is this: When…
Chad Wilson
  • 21
  • 1
  • 5
1
vote
1 answer

JavaFx: bring stage to focus on keypress

I'm trying to bring my window to focus on a keypress (using jnativehook), but getting this error: java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = JNativeHook Dispatch Thread` exception. It…
sirgyula
  • 43
  • 7
1
vote
1 answer

Making games with JNativeHook

I'm working on a simple overlay program for PC games. It's just a transparent rectangle positioned in the center of the screen but its size is controlled by the user's mouse wheel. So the concept is to simply match the size of the transparent…
1
vote
1 answer

Updating gui with JNativeHook?

I'm trying to update my GUI (for example changing text/color of jButton and jLabel via hotkey) using jnativehooks so it updates my GUI when I press a hotkey, however after hours of searching and trying, I'm still not having any luck. I have tried…
Pengiuns
  • 131
  • 2
  • 9
1
vote
2 answers

NullPointerException Error when trying to set javafx TextField text from JnativeHook mouse events

I am trying to set javafx TextField text when JnativeHook MoseClicked event happens.But i face with "NullPointerException" error.I put my Controller class code in here: public class FXMLDocumentController implements Initializable,…
Kingtak
  • 125
  • 3
  • 6
0
votes
0 answers

Issue with mouse saying its held down when its not in java (JNativeHook/JNA)

I am making a autoclicker in java for fun and keep having this issue where JNativeHook and JNA think the mouse is held down when its not, I know this is from the Robot Method causing it to change, I was wondering if there was anyway to check if the…
Demon
  • 1
0
votes
0 answers

How to save a key press to variable with jnativehook

So this is probably an obvious question, but i am just wondering if there is a way to save a key press to a variable (like a char or a string). I am relatively new to java, I know how to use scanners and how to make hash codes, I got a login screen…