Preparatory work:
Uninstall the system default old JDK, execute the following command
Rpm-qa|grep GCJ Use the above command if you see the following information: java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 use the RPM-E--nodeps command to see the information above, as shown below. RPM-E--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
1. Download the JDK:
wget--no-check-certificate--no-cookies--header "Cookie:oraclelicense=accept-securebackup-cookie"/HTTP/ download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.rpm
Note: The default download to the current directory
2, if it is a non-root user, modify the executable permissions of the current RPM file to the specified user group
chmod g+x jdk-7u71-linux-x64.rpm
3, start installing jdk1.7 in Linux, execute the following command and determine.
RPM-IVH jdk-7u71-linux-x64.rpm
The 4,linux system adds system environment variables. Execute the "vi/etc/profile" command, add the following code at the bottom of the file, and save it.
Export java_home=/usr/java/jdk1.7.0_71 # # #JAVA_HOME指明JDK安装路径, the specific value of how much, to/usr/java under view
Export CLASSPATH=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export PATH= $PATH: $JAVA _home/bin
5, execute the "source/etc/profile" command to make the system variable you just added take effect.
6, add two soft connections, execute the following command.
Ln-s-f/usr/java//usr/java/jdk1.7.0_71/jre/bin
7, execute the "java-version" command to view the JDK version and detect if the installation was successful.
8, check whether Java files can be compiled properly, executable "VI pc811.java", add the following code and save.
public class pc811 {public static void main (string[] args) {System.out.println ("pc811.com");}}
Step 9 : Execute "java Pc811.java" and execute "Java pc811" again if the output "pc811.com" means that the jdk1.7 has been successfully installed on the Linux system, and that Java and related programs can be compiled and run properly.
Linux Centos6.0 Online Installation build JDK environment