/usr/local/jdk1.7.0_01/bin/java -jar java-gearman-service-0.5.jar
Error: dl failure on line 875
Error: failed /usr/local/jdk1.7.0_01/jre/lib/i386/server/libjvm.so, because /usr/local/jdk1.7.0_01/jre/lib/i386/server/libjvm.so: cannot restore segment prot after reloc: Permission denied
经网上搜索,得到是因为SELINUX的问题。有兴趣的可以去网上查一下这个。解决问题的步骤如下:
首先编辑配置文件:/etc/selinux/config
找到如下内容:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
# SELINUX=enforcing
将# SELINUX=enforcing的注释去掉,并在下边增加这样一行:SELINUX=disabled
保存退出,结果还是报相同的错误。然后运行如下命令:
chcon -t texrel_shlib_t /usr/local/jdk1.7.0_01/jre/lib/i386/server/libjvm.so
注意,错误提示中提示哪个文件出错就在后边写上哪个文件。
结果终于可以正常运行了。但是在编译一个java的gearman的cllient的时候还是提示这个错误。于是运行如下命令:
/usr/sbin/setenforce 0
再次测试JDK安装,java -version,OK!
本文介绍如何在Linux环境下安装JDK1.7并解决由SELinux引起的相关错误。通过调整SELinux配置及使用特定命令,最终实现JDK的正常运行。
962

被折叠的 条评论
为什么被折叠?



