Linux delete your own openjdk, install jdk1.8

Source: Internet
Author: User

First step: See which packages are installed

[Email protected] ~]# Rpm-qa | grep java
Tzdata-java-2016g-2.el7.noarch
Python-javapackages-3.4.1-11.el7.noarch
Java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
Java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
Java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
Java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
Javapackages-tools-3.4.1-11.el7.noarch

Step Two: Uninstall

Execute the following command separately

[email protected] ~]# Yum Remove *openjdk*

。。。 #打印日志信息

Do you want to continue? [Y/n]:y #中途提示是否继续, enter Y, press the ENTER key to

。。。

[Email protected] ~]# Yum-remove Tzdata-java-2016g-2.el7.noarch

。。。 #打印日志信息

Do you want to continue? [Y/n]:y #中途提示是否继续, enter Y, press the ENTER key to

。。。

[email protected] ~]# Yum Remove Python-javapackages-3.4.1-11.el7.noarch

。。。 #打印日志信息

Do you want to continue? [Y/n]:y #中途提示是否继续, enter Y, press the ENTER key to

。。。

[Email protected] ~]# Rpm-qa | grep Java #最后查看, found all uninstall with Java completed (if you have not uninstalled, continue to execute the Yum remove command)

[Email protected] ~]#

Step three: Install the JDK

Here, take tar.gz as an example.

[[email protected] installfile]# tar-zxvf jdk-8u171-linux-x64.tar.gz-c/java #把安装包解压到/java Directory

Fourth Step: Configure environment variables

[Email protected] ~]# Vim/etc/profile

Export java_home=/java/jdk1.8.0_171/#这里写自己的java安装目录, this is/java/jdk1.8.0_171/.

Export path= $PATH: $JAVA _home/bin
Export Classpath=.:java_home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Fifth step: Environment variables take effect

[Email protected] ~]# Source/etc/profile

Sixth step: see if the installation is successful

[Email protected] ~]# java-version
Java Version "1.8.0_171"
Java (TM) SE Runtime Environment (build 1.8.0_171-B11)
Java HotSpot (TM) 64-bit Server VM (build 25.171-b11, Mixed mode)

The above version information appears, indicating that the JDK installation was successful!

Linux delete your own openjdk, install jdk1.8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.