赞
踩
# 安装JDK1.8
yum install java-1.8.0-openjdk
java -version
vi /etc/profile
在文件最后加上JDK的配置
# JDK Settings
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.402.b06-1.el7_9.x86_64
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# 将tar移动到/usr/local/java下进行解压
cd /usr/local/java
tar -zxvf jdk-8u172-linux-x64.gz
vi /etc/profile
# 文件末尾增加以下配置
# JDK Settings
export JAVA_HOME=/usr/local/java/jdk1.8.0_401
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
source /etc/profile
有可能遇到你重启容器或者centos7之后,找不到java命令的问题
解决办法:
将source /etc/profile
添加到/etc/bashrc
文件最后:
source /etc/bashrc
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。