在启动eclipse的时候出现错误:
failed to load the jni shared library"/usr/local/java/jdk1.6.0_21/bin/../jre/lib/i386/client/libjvm.so
百度一把,全部人都一样的结果:
在Linux下安装Eclipse出现如下错误
failed to load the jni shared library"/usr/local/java/jdk1.6.0_21/bin/../jre/lib/i386/client/libjvm.so
解决方法:关闭selinux即可解决。
# vi /etc/sysconfig/selinux
修改:SELINUX=enforcing 为:SELINUX=disable 禁用SeLinux, 再重启运行即可
如果不想重启,执行命令:setenforce 0
就可以不重启关闭selinux了禁用SeLinux有风险,还有其他办法可以解决滴,一个哥们说到:
SELinux is preventing /usr/local/eclipse/eclipse from loading /usr/local/jdk1.6.0_02/jre/lib/i386/client/libjvm.so which requires text relocation.Detailed DescriptionThe /usr/local/eclipse/eclipse application attempted to load /usr/local/jdk1.6.0_02/jre/lib/i386/client/libjvm.so which requires text relocation. This is a potential security problem. Most libraries do not need this permission. Libraries are sometimes coded incorrectly and request this permission. The SELinux Memory Protection Tests web page explains how to remove this requirement. You can configure SELinux temporarily to allow /usr/local/jdk1.6.0_02/jre/lib/i386/client/libjvm.so to use relocation as a workaround, until the library is fixed. Please file a bug report against this package.Allowing AccessIf you trust /usr/local/jdk1.6.0_02/jre/lib/i386/client/libjvm.so to run correctly, you can change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t /usr/local/jdk1.6.0_02/jre/lib/i386/client/libjvm.so"
The following command will allow this access: chcon -t textrel_shlib_t /usr/local/jdk1.6.0_02/jre/lib/i386/client/libjvm.so
请注意画线的提示,它提示我们如果想允许eclipse访问那个目录,使用这个命令。