kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.75k stars 348 forks source link

UnsatisfiedLinkError - x86_64 GNU/Linux #364

Closed entarch1980 closed 3 years ago

entarch1980 commented 3 years ago

Hi,

I have been trying to use jnativehook 2.1.0 on AWS EC2 running x86_64 GNU/Linux. I have checked libJNativeHook-2.1.0.x86_64.so is there in /tmp folder. I have also installed libxkbcommon-x11. Still I am getting this error. I also tried overriding the java.io.tmpdir, but still the same

Caused by: java.lang.UnsatisfiedLinkError: /tmp/libJNativeHook-2.1.0.x86_64.so: libXt.so.6: cannot open shared object file: No such file or directory at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817) at java.lang.Runtime.load0(Runtime.java:810) at java.lang.System.load(System.java:1088) at org.jnativehook.GlobalScreen.(Unknown Source)

Regards,

Rajeev

entarch1980 commented 3 years ago

After install libXt.so, now I am getting the below error on application startup

Temp dir ::: /home/ec2-user A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007fd4172fdfa4, pid=7013, tid=0x00007fd44fcb5700 JRE version: OpenJDK Runtime Environment (8.0_302-b08) (build 1.8.0_302-b08) Java VM: OpenJDK 64-Bit Server VM (25.302-b08 mixed mode linux-amd64 compressed oops) Problematic frame: C [libX11.so.6+0x8cfa4] XkbGetUpdatedMap+0x4

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

An error report file with more information is saved as: /home/ec2-user/jnativehook_kuldeep/hs_err_pid7013.log

If you would like to submit a bug report, please visit: https://forums.aws.amazon.com/ The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug. Aborted

kwhat commented 3 years ago

Grab that log file hs_err_pid7013.log file.

I am not sure if this is going to work in AWS-EC2, I presume you are using VNC or X11-forwarding or something like that?

kwhat commented 3 years ago

Ubuntu Dependencies:

      sudo apt-get install \
            libx11-dev:amd64 \
            libxtst-dev:amd64 \
            libxt-dev:amd64 \
            libxinerama-dev:amd64 \
            libx11-xcb-dev:amd64 \
            libxkbcommon-dev:amd64 \
            libxkbcommon-x11-dev:amd64 \
            libxkbfile-dev:amd64
entarch1980 commented 3 years ago

EC2 is having centos as underlying OS..I am not using VNC...even though X11-forwarding is turned on..I actually don't want to use any display.. I will be attaching the hs_err_pid7013.log in a bit

entarch1980 commented 3 years ago

hs_err_pid7013.log

kwhat commented 3 years ago

I actually don't want to use any display

This library has to run under X11. There is no headless / cli only mode available. If it were to run in that environment it would require root and probably a totally separate service.