JDK安装

1. 安装JDK包

[root@120_234_2_74_centos7 tools]# tar -xf jdk-8u131-linux-x64.tar.gz -C /usr/local/
[root@120_234_2_74_centos7 tools]# ln -s /usr/local/jdk1.8.0_131/ /usr/local/jdk

2. 添加环境变量

sed -i.bak  '$a export JAVA_HOME=/usr/local/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar' /etc/profile

 

一键安装

tar -xf jdk-8u131-linux-x64.tar.gz -C /usr/local/
ln -s /usr/local/jdk1.8.0_131/ /usr/local/jdk
sed -i.bak  '$a export JAVA_HOME=/usr/local/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar' /etc/profile
source /etc/profile

 

posted @ 2017-11-13 09:49  luchuangao  阅读(155)  评论(0编辑  收藏  举报