咨询1
咨询2
交流群
电话

09-CentOS7服务器搭建-Java

文档 > 服务器 2018-04-22 10:42 阅读

java下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

下载64为tar.gz版。

安装在opt目录下,并做软链接

tar -xzvf jdk-8u131-linux-x64.tar.gz
mkdir /opt/java /opt/java/jdk8
mv jdk1.8.0_131 /opt/java/jdk8/
chown -R root:root /opt/java/jdk8/jdk1.8.0_131
ln -s /opt/java/jdk8/jdk1.8.0_131 /opt/java/jdk8/default
ln -s /opt/java/jdk8/default /opt/java/default

并设置环境变量JAVA_HOME和PATH

vim /etc/profile

增加以下配置

export JAVA_HOME=/opt/java/default
export PATH=$PATH:$JAVA_HOME/bin