vi /etc/profile
export JAVA_HOME="path that you found"
export PATH=$JAVA_HOME/bin:$PATH

或者

# You could use /etc/profile or better a file like /etc/profile.d/jdk_home.sh

export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")