在Linux下安装完JDK后发现,使用javac -version正常,但是一旦使用java -version就会出问题,说是libjvm.so权限不够,这问题也困扰了我蛮久的!最后在一次偶然的情况下,发现原来是安全级别和防火墙造成的问题,于是我尝试着关闭之后一切也就正常了。
首先编辑/etc/sysconfig/selinux, 修改以下两项:
# 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 disablied.
#SELINUX=enforcing #注释掉即可
SELINUX=disabled #关闭
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
关闭完成后我们需要重启下Linux就可以了
这是重启后测试