参见:https://www.jb51.net/article/112612.htm
检查一下系统中的jdk版本
[hadoop@master ~]$ java -versionopenjdk 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)
检测jdk安装包
[hadoop@master ~]$ rpm -qa | grep javapython-javapackages-3.4.1-11.el7.noarchjavapackages-tools-3.4.1-11.el7.noarchtzdata-java-2019b-1.el7.noarchjava-1.8.0-openjdk-headless-1.8.0.222.b03-1.el7.x86_64java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64[hadoop@master ~]$
卸载openjdk
[hadoop@master ~]$ sudo yum -y remove *openjdk*[sudo] password for hadoop:Loaded plugins: langpacks, ulninfoResolving 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 Resolutionol7_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 MRemoving 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 MDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning 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!
上传安装介质并解压
[hadoop@master ~]$ sudo tar -xzf jdk-8u191-linux-x64.tar.gz -C /usr/lib/jvm
设置环境变量,在/etc/profile最前面加上
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_191export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH
最后生效一下source /etc/profile
到此这篇关于如何卸载linux自带openjdk并安装sun jdk的文章就介绍到这了,更多相关卸载openjdk并安装sun jdk内容请搜索优爱好网以前的文章或继续浏览下面的相关文章希望大家以后多多支持优爱好网!
相关文章:
1. Win11右键没有压缩选项怎么办?Win11右键没有压缩选项的解决方法2. Win11 文件资源管理器将有重大更新,新设计泄露3. Win11发布预览版Build 22000.1639更新补丁KB5022905推送(附更新修复内容汇总)4. KB5022845导致Win1122H2更新驱动失败 Surface出现0x80070103错误5. Win11回退按钮没反应怎么办?Win11回退按钮没反应的解决方法6. Win11开机后出现explorer.exe应用程序错误怎么解决? exe应用程序错误解决办法7. Win11 预览版25300怎么开启文件资源管理器图库隐藏功能?8. 为Win12让路:Win11 2023终极正式版来了9. Win11控制面板一直闪烁怎么回事?Win11控制面板打不开一直闪解决方法10. Win11 release preview通道是什么?release preview频道更新Win11好吗?