Installing JDK under CentOS

Source: Internet
Author: User

1, source Package preparation:

: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2. Unzip the source package

Unpack the Tarball:

# tar XVF jdk-7u45-linux-x64.tar.gz

To delete a compressed package:

# 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.

# Gedit/etc/profile

After opening, add at the end:

Export Java_home=/usr/local/java/jdk1.7.0_45export Jre_home=/usr/local/java/jdk1.7.0_45/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.

To make the profile effective:

#/etc/profile


4, check whether the installation is successful

# java-version

Success is shown as follows:

Java version "1.7.0_45" Java (tm) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot (tm) 64-bit Server VM (Build 24.45- B08, Mixed mode)


Installing JDK 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.