tulskiy/jkeymaster — Issue #3: X11Provider.java fails on Ubuntu 11.10
Author: scmurdock
Created: 2011-11-10 14:01:48+00:00
State: open

Hello- I've been working with your package and am very happy to find it. I previously worked with another package that relies heavily on JNI. Running your example code ProviderTest.java produces the following stack trace:

Nov 10, 2011 6:48:03 AM com.tulskiy.keymaster.x11.X11Provider$1 run
INFO: Starting X11 global hotkey provider
Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: Unable to load library 'X11': com.sun.jna.Native.open(Ljava/lang/String;)J
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239)
at com.sun.jna.Library$Handler.(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:393)
at com.sun.jna.Native.loadLibrary(Native.java:378)
at com.tulskiy.keymaster.x11.X11.(X11.java:29)
at com.tulskiy.keymaster.x11.X11Provider$1.run(X11Provider.java:56)
at java.lang.Thread.run(Thread.java:679)

I noticed you posted a similar error on the JNA project site. I don't seem to be able to fix it using your fix mentioned:

https://github.com/twall/jna/issues/12

Perhaps I'm not putting the line of code in the right place or perhaps I don't have a symlink where it ought to be, but here's the code I added:

X11Provider.java

public void init() {
Runnable runnable = new Runnable() {
public void run() {
logger.info("Starting X11 global hotkey provider");
System.setProperty("java.library.path", "/usr/lib/");//added per https://github.com/twall/jna/issues/12 [sean] 11-10-11
display = Lib.XOpenDisplay(null);

It still fails. I'm not too familiar with JNA, but would really love to get this to work on Ubuntu 11.10 :)

Any help is greatly appreciated.

Thanks!

Sean