【问题标题】:Issue with running jNotify in linux (CentOS 5.4)在 linux (CentOS 5.4) 中运行 jNotify 的问题
【发布时间】:2012-09-19 15:24:03
【问题描述】:

我正在尝试在 centos 5.4(64 位)框中设置 jnotify 以监视目录以进行文件更改。我按照说明将 libjnotify.so 放在 java 库路径中。这是我的条目


java -Xms64m -Xmx2048m -Djava.library.path=. -Dfile.encoding=UTF-8 -jar test-1.1.0.jar

当我尝试执行它时,我得到以下异常


Exception in thread "main" java.lang.UnsatisfiedLinkError: /root/testprocessor/libjnotify.so: /lib64/libc.so.6: version `GLIBC_2.12' not found (required by /root/testprocessor/libjnotify.so)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1028)
        at net.contentobjects.jnotify.linux.JNotify_linux.(Unknown Source)
        at net.contentobjects.jnotify.linux.JNotifyAdapterLinux.(Unknown Source)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at net.contentobjects.jnotify.JNotify.(Unknown Source)

该错误肯定指向 CentOS 中缺少库“GLIBC_2.12”。只是想知道是否有人遇到过类似的问题?

对此的任何指针将不胜感激。

谢谢

【问题讨论】:

    标签: java centos5 jnotify


    【解决方案1】:

    好的,在 CentOS 极客的帮助下解决了这个问题。如果有人遇到类似问题,只想分享答案。

    1. 您可以将您的 CentOS 版本升级到 6.* 以获得 GCLIB_2.12 及更高版本。

    2. 如果您处于无法升级版本的情况,您需要创建一个 libjnotify.so 并删除对 GCLIB_2.12 的依赖。这是您需要通过查看 jNotify 源代码来执行的操作。

    
    cd ~/compile
    mkdir jnotify
    cd jnotify
    unzip ~/downloads/jnotify-lib-0.94.zip
    mkdir src
    cd src
    unzip ../jnotify-native-linux-0.94-src.zip
    cd Release
    export C_INCLUDE_PATH=/usr/java/jdk1.7.0_07/include/:/usr/java/jdk1.7.0_07/include/linux/
    make
    

    这将生成 libjnotify.so ,将其复制到您的 java 库路径并重新启动 jar 文件。它应该可以解决问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 2018-07-18
      • 1970-01-01
      • 2010-10-25
      • 1970-01-01
      • 1970-01-01
      • 2013-11-20
      相关资源
      最近更新 更多