1. Software download 1. Download JDK (the following are the versions for 32-bit systems and 64-bit systems) http://download.oracle.com/otn-pub/java/jdk/7u9-b05/jdk-7u9-linux-i586.tar.gz?AuthParam=1350717577_c0836b48d7dc4cd4598cdd4f0d49e6f6 # 32 http://download.oracle.com/otn-pub/java/jdk/7u9-b05/jdk-7u9-linux-x64.rpm?AuthParam=1350717726_9b669eca29c07ddaaf6d8dc41e7a2684 # 64 # getconf LONG_BIT # View how many bits in the system Second, install JDK7.0 version 1. First uninstall the jdk package that comes with the server # java -version #Check if jdk is installed on the server java version "1.6.0_17" OpenJDK Runtime Environment (IcedTea6 1.7.4) (rhel-1.21.b17.el6-i386) OpenJDK Client VM (build 14.0-b16, mixed mode) # rpm -qa |grep gcj #View the jdk package information installed on the server libgcj-4.4.4-13.el6.i686 java-1.5.0-gcj-1.5.0.0-29.1.el6.i686 # yum -y remove java-1.5.0-gcj-1.5.0.0-29.1.el6.i686 #Uninstall the package 2. Install jdk7.0 Unzip the configuration installation # mkdir -p /usr/lib/jvm # tar zxvf jdk-7u9-linux-i586.tar.gz -C /usr/lib/jvm # mv /usr/lib/jvm/jdk1.7.0_09 /usr/lib/jvm/java7 3. Add jdk7.0 to the system environment variable # cp /etc/profile /etc/profile.bak #backup # vi /etc/profile #Edit, add the following at the end export JAVA_HOME=/usr/lib/jvm/java7 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH # source /etc/profile #Make the configuration file take effect immediately Since there may be other default versions of JDK in the system, in order to set the JDK we installed as the default JDK version, the following work is required. update-alternatives --install /usr/bin/java java /usr/lib/jvm/java7/bin/java 300 update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java7/bin/javac 300 update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java7/bin/jar 300 update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java7/bin/javah 300 update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java7/bin/javap 300 Execute the following command to set the default version. After this command is executed, the system will list the various JDK versions currently existing, and you will be prompted to select # update-alternatives --config java 4. Test # java -version # Test if the test is successful java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode)