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
0
votes
0 answers

Command Prompt returns "The syntax of the command is incorrect" when running 'ant all'

I am trying to compile jnativehook by following this tutorial. I followed all the steps (I am running on windows and have used Cygwin in some parts) until the Building section (running ant all command). I have added environment variables as…
heba
  • 119
  • 1
  • 2
  • 13
0
votes
1 answer

KeyEvents for jnativehook

I'm trying to use jnativehook for global keyboard listeners but it seems like the key codes are different. For example, I want to check if ALT + I is pressed: addNativeKeyListener(new NativeKeyAdapter() { @Override public void…
BullyWiiPlaza
  • 17,329
  • 10
  • 113
  • 185
0
votes
1 answer

Java AWT Robot places mouse clicks in completely random locations on screen [video explanation]

I am trying to write a program in which a user can create a script of clicks and key presses, and execute them in order. The most important feature of this program is being able to accurately place clicks on proper coordinates on screen. I made this…
Connor S
  • 353
  • 2
  • 12
0
votes
1 answer

Set global cursor in JavaFX

I have a button in my scene where when clicked, the cursor changes to a crosshair and the user can select an X, Y location on the screen with a mouse click, then the cursor changes back. For this, I am using scene.setCursor(Cursor.CROSSHAIR);…
Connor S
  • 353
  • 2
  • 12
0
votes
1 answer

Read each key press only once with JNativeHook

In my program want to have a text field that will contain the current keys pressed by the user. I can do this with JNativeHook, but the problem currently is that JNativeHook is registering tons of key presses when it is held down. Is there a way to…
Connor S
  • 353
  • 2
  • 12
0
votes
1 answer

Java read Windows Key State

I want to write a program that plays a sound everytime, a button on the Keyboard is pressed. (Even, if the program isn´t in focus) I am using JNativeHook, but when i want to add a Key Listener, i get an error beacuse the method .getInstance isn´t…
0
votes
0 answers

Calling C++ from java with JNI standalone methods

i need to use C++ methods from java with a compiled DLL that doesn't include the JNI Export functions. I need my DLL to be used from Java using JNA or JNI. JNA was easy to do using an interface but how can i achieve the same thing with JNI? Is it…
hugo411
  • 320
  • 1
  • 12
  • 29
0
votes
0 answers

How do you set a boolean when the mouse is clicked?

What is wrong is when I set the variable isleftmousedown to true it will test it twice when it is tested in a while loop because I tested it with a while loop and you can see this below! If it helps you I am using JNativeHook with this…
0
votes
0 answers

Actor not remembering state

I am trying to create a sample application that monitors key strokes from scala on a windows machine using the jNativeHook library. I have the following listener that listens for events, object KeyListener extends…
Som Bhattacharyya
  • 3,972
  • 35
  • 54
0
votes
0 answers

JNativeHook doesn't work with Jython (JES)

I was trying to implement JNativeHook on jython, using JES. I tried using JNativeHook on pure Java, and it does work as expected, yet, the same thing on jython throws an exception. The exception NoClassDefFoundError occurs on…
blkgoose
  • 93
  • 7
0
votes
1 answer

JNativeHook Ant compile error: "Cannot run program 'sh'"

I am trying to compile the JNativeHook source code on my Windows 7 system. By giving the ant all command in the root folder, I got the following error: C:\Users\Nrusingh\Downloads\jnativehook-master (1)\jnativehook-master>ant all Buildfile:…
mitu1234
  • 135
  • 6
-1
votes
1 answer

NoClassDefFoundError after importing library

I have made a small program that simulates mouse movements. Everything has worked as supposed to so far till i added the jnativehook library for listening to keyboard input to stop the program. After this the problems started to occur, when i…
Neko
  • 18
  • 5
-2
votes
1 answer

Java: Program closes, when it has to listen

So I'm trying to "log" keys that are being pressed. The problem is when I run my code, the program just auto stops and sends me back to where I can code. I use Eclipse import org.jnativehook.keyboard.NativeKeyEvent; import…
1 2 3
4