在Linux(CentOS 5.4)中运行jNotify的问题 [英] Issue with running jNotify in linux (CentOS 5.4)

查看:337
本文介绍了在Linux(CentOS 5.4)中运行jNotify的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to setup jnotify in a centos 5.4 (64 bit) box to monitor directories for file change. I followed the instruction by putting the libjnotify.so in java library path. Here's my entry


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

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

When I try to execute it, I'm getting the following exception


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'。只想知道是否有人遇到过类似的问题?

The error certainly points to missing library 'GLIBC_2.12' in CentOS. Just wanted to know if anyone faced similar issues ?

对此,任何指针都会受到赞赏。

Any pointer on this will be highly appreciated.

谢谢

推荐答案

好,在CentOS怪胎的帮助下解决了它。只是想在任何人遇到类似问题时共享答案。

Ok, resolved it with the help of a CentOS geek. Just thought of sharing the answer if anyone encounters a similar issue.


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

  1. You can upgrade your CentOS version to 6.* to get the GCLIB_2.12 and above.

如果在我无法进行版本升级的情况下,则需要创建 libjnotify.so ,并删除对 GCLIB_2.12 的依赖。签出jNotify源代码,这就是您需要做的。

If you are in my situation where version upgrade is not an option, you need create a libjnotify.so and remove the dependency on GCLIB_2.12. Here's what you need to do by checking out jNotify source code.




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文件。它应该可以解决问题。

This will generated libjnotify.so , copy it to you java library path and restart the jar file. It should resolve the issue.

这篇关于在Linux(CentOS 5.4)中运行jNotify的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆