Installing JDK1.7 under CentOS

Source: Internet
Author: User

1, source Package preparation:

First download the JDK to the official website, i download jdk-7u55-linux-i586.tar.gz, download to the home directory

2. Unzip the source package

Create a new Java folder from the terminal in the/usr/local directory, command line:

[Email protected] ~]# Mkdir/usr/local/java

Then copy the download to the archive into the Java folder, the command line:

Enter the directory where the JDK source package resides

[email protected] ~]# CP Jdk-7u45-linux-x64.tar.gz/usr/local/java

Then go to the Java directory, command line:

[Email protected] ~]# Cd/usr/local/java

Unzip the Tarball, command line:

[Email protected] java]# tar xvf jdk-7u45-linux-x64.tar.gz

You can then delete the compressed package, command line:

[Email protected] java]# RM jdk-7u45-linux-x64.tar.gz

3. Setting the JDK environment variable

The global setting method here is to modify Etc/profile, which is a common environment variable for all users.

[Email protected] ~]# Gedit/etc/profile

After opening, add at the end

Export java_home=/usr/local/java/jdk1.7. 0_55export jre_home=/usr/local/java/jdk1.7.0_55/jreexport CLASSPATH=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib: $CLASSPATHexport PATH=$ Java_home/bin: $PATH

Keep in mind that during the add-on process, do not add a space on either side of the equal sign, or "not a valid identifier", because the Source/etc/profile does not recognize the extra space and is understood to be part of the path.

and then save

[Email protected] ~]# Source/etc/profile

Make profile effective

4, check whether the installation is successful

In the terminal

Java-version

See if the installation is successful

Success shows the following

[Email protected] java]# java-"1.7.0_79"OpenJDK Runtime Environment (Rhel-2.5.5.4.el6-i386 u79-  24.79-b02, mixed mode, sharing)

Installing JDK1.7 under CentOS

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.