System: Ubuntu 10.04
JDK: jdk-6u20-linux-i586.bin
1. Install JDK
1. Install JDK
Sudo chmod U + x jdk-6u16-linux-i586.bin sudo CP-A jdk-6u20-linux-i586.bin/OPT sudo/opt/jdk-6u20-linux-i586.bin sudo Rm-F/opt/jdk-6u20-linux-i586.bin
2. Set JDK Environment Variables
Add sudo gedit/etc/profileCode: # Set Java environment export java_home =/opt/jdk1.6.0 _ 20 export jre_home = $ java_home/JRE export classpath = $ classpath: $ java_home/lib: $ jre_home/lib export Path = $ path: $ java_home/bin: $ jre_home/bin save and exit.
3. Make the environment variable take effect immediately
Source/etc/profile: Save the settings; otherwise, restart the instance to take effect.
4. Test
Java-version if Java version "1.6.0 _ 20" Java (TM) se Runtime Environment (build 1.6.0 _ 20-b02) Java hotspot (TM) server VM (build 16.3-b01, mixed mode) is displayed) the installation is successful.
Ii. Uninstall JDK
1. Delete the JDK directory
Sudo Rm-RF/opt/jdk1.6.0 _ 20
Sudo gedit/etc/profile deletion code: # Set Java environment export java_home =/opt/jdk1.6.0 _ 20 export jre_home = $ java_home/jreexport classpath = $ classpath: $ java_home/lib: $ jre_home/libexport Path = $ path: $ java_home/bin: $ jre_home/bin save and exit.