Installing JDK7 on Linux

Source: Internet
Author: User

See if the JDK is installed

If the JDK version is not currently installed after installation, you will need to uninstall the JDK version that was originally brought with Linux, because the JDK is installed by default after installing REDHAT9, but the default installation of the jdk1.4 version is older, so you need to uninstall the original Java version first.

[[Email protected]]# java-version View installed Java version information

[[Email protected]]# rpm-qa |grep-i Java view Java Installation Status command

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

Uninstall the previously installed jdk1.4 using the RPM-E--nodeps command:

[[email protected]] #rpm-e--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

[[Email protected]]# rpm-qa |grep-i java re-enter query Java installation Status command, return value is empty, prove uninstall jdk1.4 success

Second installation of JDK

1 Download JDK from Oracle's official website

Http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html

Download latest Version jdk-7u9-linux-i586.rpm

Create a new software folder under/and place the installation package in the/software location

[[email protected]] #mkdir/software

Note:

You should choose a 32-bit or 64-bit JDK installation package based on the number of bits of Linux you use. Get the Linux system to be 32-bit or 64-bit commands:

Getconf Long_bit

32

So Linux needs to download a 32-bit JDK, jdk-7u21linux-i586.rpm

2 Installing the JDK

[[email protected]] #cd/software

[[email protected]] #chmod 777 jdk-7u9-linux-i586.rpm//grant JDK-7U9-LINUX-I586.RPM executable permission

[[Email protected]]# RPM-IVH jdk-7u9-linux-i586.rpm//install JDK, select Yes to agree to the above protocol, know the installation is complete

3 Configuring the JDK

Vi/etc/profile//Edit config file, add the following statement in profile profiles

Export Java_home=/usr/java/jdk1.7.0_21

Export classpath= $JAVA _home/lib:.:

Export path= $PATH:.: $JAVA _home/bin:

Source/etc/profile//Make configuration file effective

4 View JDK default installation path

Whereis Java

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.