Awesome Open Source
Awesome Open Source

Maven Central


JNativeHook is a library to provide global keyboard and mouse listeners for Java. This will allow you to listen for global shortcuts or mouse motion that would otherwise be impossible using pure Java. To accomplish this task, JNativeHook leverages platform-dependent native code through Java's native interface to create low-level system-wide hooks and deliver those events to your application.

The following events are available via their respective listeners.

  • Key Press Events
  • Key Release Events
  • Key Typed Events
  • Mouse Down Events
  • Mouse Up Events
  • Mouse Click Events
  • Mouse Move Events
  • Mouse Drag Events
  • Mouse Wheel Events

In addition to global event listeners, this library has the ability to post native events back to the native operating system.


Binary distribution for JNativeHook can be found at the releases section of the project page. Maven users can use the <groupId>com.1stleg</groupId> and <artifactId>jnativehook</artifactId> to include this library automatically. The nightly builds can be found at the maven snapshot repository.

Software and Hardware Requirements

  • Java 1.5 - 1.8
  • 256 MB of RAM
  • Apple OS X 10.5 - 10.12
    • i586, amd64
    • Enable Access for Assistive Devices
  • Windows 2000 - 10
    • i586, amd64
  • X11 Linux
    • i586, amd64, arm6j


If you have found this library useful, please consider making a donation. Donate

Compiling Instructions

Detailed instructions to compile from source are available in the wiki.

Demo Application

The graphical example application was created to provided a real-time demonstration of raw output for all available native events. To run the application simply execute the jar file provided. Source code available at src/java/org/jnativehook/example/

Example Code

Additional Information

Up to date source code and documentation available at:

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (388,359
C (181,946
Keyboard (10,062
Mouse (6,851
Listener (5,999
Keyboard Listeners (20
Global Hotkeys (15
Mouse Listener (7
Jnativehook (5
Native Events (5