无法初始化jNativeHook 2.0

时间:2015-02-13 00:21:43

标签: java

我正在尝试使用库JNativeHook 2.0拦截键盘事件,请参阅:

import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;

public class MainApp {

    public static void main(String[] args) {
        try {
            GlobalScreen.registerNativeHook();
        }
        catch (NativeHookException ex) {
            System.err.println("There was a problem registering the native hook.");
            System.err.println(ex.getMessage());

            System.exit(1);
        }

        GlobalScreen.addNativeKeyListener(new Intercept());
    }

}

但是当我尝试启动MainApp时,我收到了错误:

Fev 12, 2015 9:12:53 PM org.jnativehook.DefaultLibraryLocator getLibraries
Informações: Library extracted successfully: /tmp/libJNativeHook-2.0.0.so (0xE9C5AD25418C597994B824E5A9D62858192227D).

/usr/lib/jvm/java-7-oracle/bin/java: symbol lookup error: /tmp/libJNativeHook-2.0.0.so: undefined symbol: hook_set_logger_proc

1 个答案:

答案 0 :(得分:0)

hook_set_logger_proc应该在链接时由libuiohook定义。这可能与Issue #43有关。