![](https://i-blog.csdnimg.cn/blog_migrate/4525572b5180f700f2d63f8b8523f165.png)
sudo chmod 777 /etc/profile
source /etc/profile
echo 'export JAVA_HOME=/usr/java8' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
source /etc/profile
sudo chmod 777 /etc/profile
source /etc/profile
echo 'export JAVA_HOME=/usr/java8' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
source /etc/profile