Linux installation JDK

Source: Internet
Author: User

First, the software download
1. Download JDK (Below are 32-bit system and 64-bit system version)
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 # See how many bits of the system

Second, install JDK7.0 version
1, first uninstall the server's own JDK package
# java-version #查看服务器是否安装过jdk
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 #查看服务器安装的jdk软件包信息
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 #卸载软件包
2, Installation jdk7.0
Decompression 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 System environment variables
# Cp/etc/profile/etc/profile.bak #备份
# Vi/etc/profile #编辑, 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 #使配置文件立即生效
Since there may be a default version of the JDK in the system, the following work will be done to set up our installed JDK as the default JDK version.
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, set the default version, after this command executes, the system will list the various JDK versions that are currently present, prompting you to select
# update-alternatives--config Java
4. Testing
# java-version # 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)

Linux installation JDK

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.