Linux安装JDK

Posted 落叶随风起

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux安装JDK相关的知识,希望对你有一定的参考价值。

卸载open jdk

[root@nam-qa2 ~]# java -version
openjdk version "1.8.0_222-ea"
OpenJDK Runtime Environment (build 1.8.0_222-ea-b03)
OpenJDK 64-Bit Server VM (build 25.222-b03, mixed mode)
[root@nam-qa2 ~]# rpm -qa|grep java
tzdata-java-2019b-1.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.222.b03-1.el7.x86_64
java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64
[root@nam-qa2 ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64
[root@nam-qa2 ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.222.b03-1.el7.x86_64

1.JDB版本:jdk-8u171-linux-x64.tar.gz

2.Get JDK version from https://www.oracle.com/technetwork/java/javase/downloads/index.html and tar the gz package

安装lrzsz: yum -y install lrzsz

3.Editting the profile file

vi /etc/profile

添加如下内容:JAVA_HOME根据实际目录来

# jdk env
export JAVA_HOME=/software/jdk/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}

 

4.使profile生效

source /etc/profile

5.查看安装情况

[root@server-003 jdk]# java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

Note:jps command can not find<JDK 版本问题>

 

以上是关于Linux安装JDK的主要内容,如果未能解决你的问题,请参考以下文章

linux 中使用yum安装jdk

Linux安装JDK详细步骤

linux----CenterOS7中在线安装jdk

服务器( && Centos 7 )安装JAVA环境JDK1.8

linux系统中jdk安装

linux下如何安装jdk并配置环境