Liunx安装jdk
1.下载jdk
jdk-8u231-linux-x64.tar.gz
2.解压jdk
tar -zxvf jdk-8u231-linux-x64.tar.gz
3.在/usr/local目录下创建jdk目录
mkdir jdk
4.把解压的jdk1.8.0_231移到/usr/local/jdk目录下
mv jdk1.8.0_231 /usr/local/jdk
5.添加jdk环境
vim /etc/profile
在末尾添加内容
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_231 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
7.刷新profile
source /etc/profile
8.查看jjdk版本java –version
[root@localhost jdk1.8.0_231]# java -version java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode) [root@localhost jdk1.8.0_231]#