Built-in JDK for Linux uninstall
10:52:13 | category: Default category | label: Linux Server uninstall JDK | font size subscription
[Root @ localhost soft] # Java-version
Java version "1.4.2 ″
Gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)
Note: According to my installation in 5.2, it seems that the built-in 1.4 is not uninstalled, and the installation of JDK 6 cannot take effect. To avoid this problem, we first need to uninstall JDK 1.4.
[Root @ localhost soft] # rpm-Qa | grep JDK
[Root @ localhost soft] # rpm-Qa | grep gcj
Libgcj-4.1.2-42.el5
Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
First confirm the specific JDK version number, and then
[Root @ localhost jdk1.6.0 _ 11] # Yum-y remove java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Setting up remove Process
Resolving dependencies ........... (Start to uninstall)
Removed: java-1.4.2-gcj-compat.i386. 4.2.0-40jpp. 115
Dependency removed: anlr. i386 0: 2. 7.6-4jpp. 2 BSF. i386 0: 2. 3.0-11jpp. 1 bsh. i386 0: 1. 3.0-9jpp. 1 gjdoc. i386 0: 0. 7.7-12. EL5 HSQLDB. i386 1:1. 8.0.9-1jpp. 2 OpenOffice.org-Calc. i386
. 3.0-container OpenOffice.org-core. i386. 3.0-container OpenOffice.org-draw. i386. 3.0-container OpenOffice.org-graphicfilter. i386. 3.0-6.5.el5 OpenOffice.org-impress. i386
. 3.0-6.5.el5 OpenOffice.org-langpack-zh_CN.i386. 3.0-6.5.el5 OpenOffice.org-langpack-zh_TW.i386. 3.0-6.5.el5 OpenOffice.org-math. i386. 3.0-6.5.el5 OpenOffice.org-
Writer. i386. 3.0-6.5.el5 OpenOffice.org-effectfilter. i386. 3.0-6.5.el5 tomcat5-jsp-2.0-api.i386. 5.23-0jpp. 7. EL5 tomcat5-servlet-2.4-api.i386. 5.23-0jpp. 7. EL5 xalan-
J2.i386. 7.0-6jpp. 1 xerces-j2.i386. 7.1-7jpp. 2 xml-commons-apis.i386. 3.02-0. b2.7jpp. 10 xml-commons-resolver.i386. 1-1jpp.12
Complete! (Uninstall completed)
The installation package I am using is a jdk-6u11-linux-i586.bin and does not use a general RPM package for the Red Hat platform.
First, upload the jdk-6u11-linux-i586.bin to/home/xjj/soft over ssh. Then, to give the jdk-6u11-linux-i586.bin
Assign permissions, specifically here to give it executable permissions, input: chmod + x jdk-6u11-linux-i586.bin, where the parameter x even executes permissions.
[Root @ localhost soft] # chmod + x jdk-6u11-linux-i586.bin
Then unzip:./jdk-6u11-linux-i586.bin,
[Root @ localhost soft] #./jdk-6u11-linux-i586.bin
After the execution, there will be a bunch of agreement or something, all the way more. Then there is a confirm installation, enter yes, and then press Enter. Start decompression. Until
Java (TM) se Development Kit 6 successfully installed.
.........
Press enter to continue .....
Done.
Look at the extracted files first
[Root @ localhost soft] # ls
Jdk1.6.0 _ 11 jdk-6u11-linux-i586.bin
[Root @ localhost soft] # cd jdk1.6.0 _ 11
[Root @ localhost jdk1.6.0 _ 11] # ls
Bin DB include lib man readme_ja.html register.html register_zh_cn.html src.zip
Copyright demo JRE license readme.html readme_zh_cn.html register_ja.html sample thirdpartylicensereadme.txt
Haha, You can decompress what we are familiar. Generally, the installation file is stored in usr/local. Of course you can't take it if you don't. Therefore, run the Copy command first:
[Root @ localhost soft] # mv jdk1.6.0 _ 11/usr/local
[Root @ localhost xjj] # cd ../..
[Root @ localhost/] # ls
Bin Dev home lost + found MISC net proc sbin srv tmp VaR
Boot etc lib media MNT opt root SELinux sys USR
[Root @ localhost/] # cd/usr/local
[Root @ localhost local] # ls
Bin etc games include jdk1.6.0 _ 11 lib libexec sbin share SRC
Now, JDK has been successfully moved to/usr/local, and the last step is to set the environment variable. There are two in-process settings, one is to temporarily take effect through the Export settings, restart
Subsequent settings will be lost. One is to write the settings to the/etc/profile file, which can always take effect. Therefore, the best setting is to write to the file. Run the following command:
[Root @ localhost jdk1.6.0 _ 11] # vi/etc/profile
Open the profile file, enter I to enter insert mode, and add the following content to the file.
Export java_home =/usr/local/jdk1.6.0 _ 11
Export Path = $ path: $ java_home/bin
Export classpath =.: $ java_home/lib/tools. jar: $ java_home/lib/RT. Jar
Then run ESC, enter: X, save and exit. Then you need to set the change to take effect:
[Root @ localhost local] # source/etc/profile
Of course, if you like to restart, you can also reboot.
Let's take a look at the current JDK version:
[Root @ localhost local] # Java-version
Java version "1.6.0 _ 11 ″
Java (TM) se Runtime Environment (build 1.6.0 _ 11-b03)
Java hotspot (TM) Client VM (build 11.0-f8, mixed mode, sharing)
Success!