How to uninstall Linux's native openjdk and install sun jdk

How to uninstall Linux's native openjdk and install sun jdk

See: https://www.jb51.net/article/112612.htm

Check the jdk version in the system

[hadoop@master ~]$ 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)

Detect jdk installation package

[hadoop@master ~]$ rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
tzdata-java-2019b-1.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
[hadoop@master ~]$

Uninstall openjdk

[hadoop@master ~]$ sudo yum -y remove *openjdk*
[sudo] password for hadoop:
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.222.b03-1.el7 will be erased
--> Processing Dependency: java >= 1.5 for package: jline-1.0-8.el7.noarch
--> Processing Dependency: java-1.8.0-openjdk for package: icedtea-web-1.7.1-1.el7.x86_64
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b03-1.el7 will be erased
--> Running transaction check
---> Package icedtea-web.x86_64 0:1.7.1-1.el7 will be erased
---> Package jline.noarch 0:1.0-8.el7 will be erased
--> Processing Dependency: jline for package: rhino-1.7R5-1.el7.noarch
--> Running transaction check
---> Package rhino.noarch 0:1.7R5-1.el7 will be erased
--> Finished Dependency Resolution
ol7_UEKR5/x86_64 | 2.5 kB 00:00:00 
ol7_latest/x86_64 | 2.7 kB 00:00:00 
 
Dependencies Resolved
 
==========================================================================================================================================================================================================
 Package Arch Version Repository Size
==========================================================================================================================================================================================================
Removing:
 java-1.8.0-openjdk x86_64 1:1.8.0.222.b03-1.el7 @anaconda/7.7 642 k
 java-1.8.0-openjdk-headless x86_64 1:1.8.0.222.b03-1.el7 @anaconda/7.7 106 M
Removing for dependencies:
 icedtea-web x86_64 1.7.1-1.el7 @anaconda/7.7 2.3 M
 jline noarch 1.0-8.el7 @anaconda/7.7 72 k
 rhino noarch 1.7R5-1.el7 @anaconda/7.7 1.1 M
 
Transaction Summary
==========================================================================================================================================================================================================
Remove 2 Packages (+3 Dependent packages)
 
Installed size: 110 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Erasing: icedtea-web-1.7.1-1.el7.x86_64 1/5
 Erasing: rhino-1.7R5-1.el7.noarch 2/5
 Erasing: jline-1.0-8.el7.noarch 3/5
 Erasing : 1:java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64 4/5
 Erasing : 1:java-1.8.0-openjdk-headless-1.8.0.222.b03-1.el7.x86_64 5/5
 Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.222.b03-1.el7.x86_64 1/5
 Verifying : 1:java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64 2/5
 Verifying: icedtea-web-1.7.1-1.el7.x86_64 3/5
 Verifying : rhino-1.7R5-1.el7.noarch 4/5
 Verifying : jline-1.0-8.el7.noarch 5/5
 
Removed:
 java-1.8.0-openjdk.x86_64 1:1.8.0.222.b03-1.el7 java-1.8.0-openjdk-headless.x86_64 1:1.8.0.222.b03-1.el7            
 
Dependency Removed:
 icedtea-web.x86_64 0:1.7.1-1.el7 jline.noarch 0:1.0-8.el7 rhino.noarch 0:1.7R5-1.el7          
 
Complete!

Upload the installation media and unzip it

[hadoop@master ~]$ sudo tar -xzf jdk-8u191-linux-x64.tar.gz -C /usr/lib/jvm

Set the environment variables and add it at the beginning of /etc/profile

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

Finally, source /etc/profile

This is the end of this article about how to uninstall openjdk that comes with linux and install sun jdk. For more relevant content about uninstalling openjdk and installing sun jdk, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Introduction to installing JDK under Linux, including uninstalling OpenJDK

<<:  Best Practices Guide for MySQL Partitioned Tables

>>:  JavaScript Array Methods - Systematic Summary and Detailed Explanation

Recommend

Vue implements image drag and drop function

This article example shares the specific code of ...

Example of adding attributes using style in html

Add inline styles to the required links: Copy code...

Briefly describe the difference between MySQL and Oracle

1. Oracle is a large database while MySQL is a sm...

Summary of 10 amazing tricks of Element-UI

Table of contents el-scrollbar scroll bar el-uplo...

Detailed explanation of Nginx passively checking the server's survival status

introduce Monitors the health of HTTP servers in ...

Experience of redesigning the homepage of TOM.COM

<br />Without any warning, I saw news on cnB...

Docker deployment of Flask application implementation steps

1. Purpose Write a Flask application locally, pac...

A brief analysis of the use of zero copy technology in Linux

This article discusses several major zero-copy te...

Analysis of MySQL lock mechanism and usage

This article uses examples to illustrate the MySQ...

Getting Started with Nginx Reverse Proxy

Table of contents Overview The role of reverse pr...

Two ways to correctly clean up mysql binlog logs

mysql correctly cleans up binlog logs Preface: Th...

W3C Tutorial (12): W3C Soap Activity

Web Services are concerned with application-to-ap...

Detailed explanation of Vue component reuse and expansion

Table of contents Overview Is the extension neces...

Vue3 encapsulates its own paging component

This article example shares the specific code of ...