0%
卸载 CentOS 自带 Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| [22:12:54] root :: sun ➜ ~ » rpm -qa|grep java java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 javapackages-tools-3.4.1-11.el7.noarch tzdata-java-2020a-1.el7.noarch python-javapackages-3.4.1-11.el7.noarch java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64 [22:13:44] root :: sun ➜ ~ » yum -y remove java-1.8.0-openjdk-headless.x86_64 Loaded plugins: fastestmirror, langpacks Resolving Dependencies Running transaction check Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.262.b10-1.el7 will be erased Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.262.b10-1.el7 for package: 1:java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 Processing Dependency: libjava.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 Processing Dependency: libjvm.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 Processing Dependency: libjvm.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 Running transaction check Package java-1.8.0-openjdk.x86_64 1:1.8.0.262.b10-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-2.el7_6.x86_64 Running transaction check Package icedtea-web.x86_64 0:1.7.1-2.el7_6 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
Dependencies Resolved
======================================================================================================== Package Arch Version Repository Size ======================================================================================================== Removing: java-1.8.0-openjdk-headless x86_64 1:1.8.0.262.b10-1.el7 @anaconda 109 M Removing for dependencies: icedtea-web x86_64 1.7.1-2.el7_6 @anaconda 2.3 M java-1.8.0-openjdk x86_64 1:1.8.0.262.b10-1.el7 @anaconda 646 k jline noarch 1.0-8.el7 @anaconda 72 k rhino noarch 1.7R5-1.el7 @anaconda 1.1 M
Transaction Summary ======================================================================================================== Remove 1 Package (+4 Dependent packages)
Installed size: 113 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : icedtea-web-1.7.1-2.el7_6.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.262.b10-1.el7.x86_64 4/5 Erasing : 1:java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64 5/5 Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64 1/5 Verifying : 1:java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64 2/5 Verifying : rhino-1.7R5-1.el7.noarch 3/5 Verifying : icedtea-web-1.7.1-2.el7_6.x86_64 4/5 Verifying : jline-1.0-8.el7.noarch 5/5
Removed: java-1.8.0-openjdk-headless.x86_64 1:1.8.0.262.b10-1.el7
Dependency Removed: icedtea-web.x86_64 0:1.7.1-2.el7_6 java-1.8.0-openjdk.x86_64 1:1.8.0.262.b10-1.el7 jline.noarch 0:1.0-8.el7 rhino.noarch 0:1.7R5-1.el7
Complete! [22:14:08] root :: sun ➜ ~ » [22:14:09] root :: sun ➜ ~ » [22:14:09] root :: sun ➜ ~ » rpm -qa|grep java javapackages-tools-3.4.1-11.el7.noarch tzdata-java-2020a-1.el7.noarch python-javapackages-3.4.1-11.el7.noarch
|
配置 Java 环境
编辑 ~/.bashrc
文件,添加:
1 2 3 4 5 6
|
export JAVA_HOME=/usr/local/bin/java/jdk1.8.0_231 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
|
source ~/.bashrc
使修改生效