1. Check the JDK in the current operating system:Rpm-Qa | grep Java(Or
Rpm-Qa | grep JDK) (Or
Rpm-Qa | grep gcj)
2. Delete the built-in JDK:Yum-y removeJava -*
3. Download JDK:Http://www.oracle.com/technetwork/java/javase/downloads/index.html
4. decompress the package:Tar zxvf JDK -*
5. Mobile:MV jdk1.7.0 _ 03/*/home/JDK
6. Edit the system environment variables:Vim/etc/profile
7. Add the JDK path to the system environment variable:
Export java_home =/home/JDK
Export Path = $ path: $ java_home/bin
Export classpath =.: $ java_home/JRE/lib/RT. jar: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
8. Verify JDK:Java-version/
Javac-version(Logout or restart after installation)
Method 2: (not recommended because binfile download is no longer available on the official website)
1, download: jdk-6u22-linux-i586-rpm.bin
2, installation: chmod 777 jdk-6u22-linux-i586-rpm.bin->./jdk-6u22-linux-i586-rpm.bin
3. Edit the system environment variable gedit/etc/profile.
Export java_home =/usr/Java/jdk1.6.0 _ 22
Export classpath = $ classpath: $ java_home/lib: $ java_home/JRE/lib
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path: $ homr/bin