Http://hi.baidu.com/mengyancui/item/eb343435908cc19ab90c033a
1. Download and install
1. First go to http://www.oracle.com/technetwork/java/index.htmlto download the jdk1.6 Linux version, such as: jdk-6u20-linux-i586.bin;
2. Copy or cut the jdk-6u20-linux-i586.bin to/usr/local... (You can also put it in another directory );
3. CD/usr/local
Sudo chmod U + x jdk-6u20-linux-i586.bin
Sudo-S./jdk-6u20-linux-i586.bin;
4. Follow the prompts to operate ...... Installation complete;
2. Configure environment variables;
Method 1:
Enter the command sudo gedit/etc/profile (this is equivalent to modifying the system configuration file, which affects all users ),
Or sudo/home/user/. bashr, or bashrc. (Only for User Users)
Paste the following information in the last line of the pop-up file:
Export java_home =/usr/local/jdk1.6.0 _ 20
Export jre_home =/usr/local/jdk1.6.0 _ 20/JRE
Export classpath =.: $ java_home/lib: $ jre_home/lib: $ classpath
Export Path = $ java_home/bin: $ jre_home/bin: $ path
Method 2: Use the Export command, but this method only works for the current shell. It is invalid after the system is restarted or a new shell is opened.
After the machine is restarted, enter the following information in the terminal: Java-version, indicating that the installation and configuration are correct.
:~ $ Java-version
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)
3. Uninstall JDK
1. Delete the JDK directory
Sudo Rm-RF/usr/local/jdk1.6.0 _ 20
2. Delete JDK Environment Variables
Sudo Vim/etc/profile
Export java_home =/usr/local/jdk1.6.0 _ 20
Export jre_home =/usr/local/jdk1.6.0 _ 20/JRE
Export classpath =.: $ java_home/lib: $ jre_home/lib: $ classpath
Export Path = $ java_home/bin: $ jre_home/bin: $ path
Save and exit.