Linux中JDK安装

进入JDK下载页面:https://www.oracle.com/technetwork/java/javase/downloads/index.html

 

 

 解压

tar -zxvf jdk-8u281-linux-x64.tar.gz

配置环境变量

vi /etc/profile

添加内容

export JAVA_HOME=/root/rj/jdk/jdk1.8.0_281
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

测试

[root@lcl-aliyun jdk1.8.0_281]# java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

 

posted @ 2021-03-20 09:59  李聪龙  阅读(53)  评论(0编辑  收藏  举报