这个问题两步搞定
第一、找到 /etc/environment文件,这个文件是系统默认加载的环境变量文件;同于在我们配置的jdk环境变量后,jdk环境变量会霸占/etc/environment下的环境变量,当你登录系统时无法进行,当用户验证通过学后,系统老是重新启动,无法登录。其实我们知道在ubuntu下配置JDK的全局环境变量是在/etc/profile文件中配置 ,所以我们只要把environment文件中的系统默认的环境变量拷贝到profile文件中的PATH中就行了啦。
第二、配置/etc/profile文件内容如下:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
if [ "$PS1" ]; then
if [ "$BASH" ]; then
PS1='\u@\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
JAVA_HOME=/opt/java/jdk1.6.0_22
export JAVA_HOME
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME/bin
export PATH
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jir/lib
export CLASSPATH
umask 022
哈哈 这样就搞定,简单吧