Redhat Linux Installation JDK 1.7

Source: Internet
Author: User

This article focuses on installing JDK 1.7 on the Redhat Linux (Red Hat Enterprise linux Server release 5.7 (tikanga)) system, and other Linux platform installations are similar and may be slightly different.

Step 1: Download the JDK 1.7 installation package

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

There are two points to note during the download process:

1: Note the operating system version, and the 32-bit or 64-bit operating system. As shown below, Linux is divided into x86, x64 two kinds,

Product/file Description

File Size

Download

Linux x86

80.38 MB

jdk-7u25-linux-i586.rpm

Linux x86

93.12 MB

Jdk-7u25-linux-i586.tar.gz

Linux x64

81.46 MB

jdk-7u25-linux-x64.rpm

Linux x64

91.85 MB

Jdk-7u25-linux-x64.tar.gz

2: Note whether the installation package is in RPM or tar.gz format. RPM is the standard installation package for Red Hat and some Linux systems are not supported by Redhat packages. RPM installation will be automatically configured, usually Lib installed to/urs/bin, bin installed under the/usr/bin, if not installed under/urs/bin, will also establish a soft connection in this directory.

Step 2: upload the JKD 1.7 installation package

Under normal circumstances you can use the FPT tool to upload the installation JDK installation package, because here I use virtual machine to do experiments, this machine is the win 7 Professional version of the 64-bit operating system, so you have to ensure that under Linux access to the files under Windows. Under Virtual machine settings, click Options-Shared Folders, select Always on, and then follow the wizard to set up the folders you want to share. Then you can see the JKD folder under/mnt/hgfs/and copy the JKD installation package to the ~/tmp/file.

[Email protected] ~]# cd/mnt/hgfs/

[[email protected] hgfs]# ls

JKD

[Email protected] hgfs]# CD JKD

[[email protected] jkd]# ls

jdk-7u25-linux-x64.rpm jdk-7u25-linux-x64.tar.gz

[Email protected] jkd]#

[email protected] jkd]# CP jdk-7u25-linux-x64.rpm ~/tmp/

[email protected] jkd]# CP jdk-7u25-linux-x64.tar.gz ~/tmp/

Step 3: Check if there are other versions of the JDK on the Linux system, and if so, uninstall the old version of JKD first.

[Email protected]/]# java-version

Java Version "1.4.2"

Gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-51)

Copyright (C) 2006 free Software Foundation, Inc.

This was free software; See the source for copying conditions. There is NO

Warranty Not even to merchantability or FITNESS for A particular PURPOSE.

View information about your own JDK

[Email protected] ~]# Rpm-qa | grep GCJ

Libgcj-4.1.2-51.el5

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

Libgcj-4.1.2-51.el5

Uninstalling the information of your own JDK

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

Step 4: unzip the installation JDK

RPM Package Installation

[Email protected] tmp]# chmod +x jdk-7u25-linux-x64.rpm

[Email protected] tmp]# RPM-IVH jdk-7u25-linux-x64.rpm

Preparing ... ########################################### [100%]

1:JDK ########################################### [100%]

Unpacking JAR files ...

Rt.jar ...

Jsse.jar ...

Charsets.jar ...

Tools.jar ...

Localedata.jar ...

Tar Package Installation

New Folder/usr/java/

[Email protected] usr]# mkdir java

[Email protected] usr]# CD ~/tmp

[Email protected] tmp]# tar xzvf jdk-7u25-linux-x64.tar.gz-c/usr/java/

Step 5: Configure environment variables

Add under the Etc/profile file

Export java_home=/usr/java/jdk1.7.0_25

Export Classpath=/usr/java/jdk1.7.0_25/lib

Export path= $JAVA _home/bin: $PATH

If you do not want to re-system, you can use the command source/etc/profile to make the configuration file effective immediately. Otherwise, the system can only be restarted for the configuration parameters to take effect.

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

Verify that the environment variable is in effect

[Email protected] ~]# echo $JAVA _home

/usr/java/jdk1.7.0_25

[Email protected] ~]# echo $PATH

/usr/java/jdk1.7.0_25/bin:/usr/kerberos/sbin:/usr/kerberos/bin

:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/x11r6/bin:/root/bin

[Email protected] ~]# echo Echo $CLASSPATH

/usr/java/jdk1.7.0_25/lib

[Email protected] ~]#

Step 6: Verify that the installation is successful, and that the environment variables are in effect

[Email protected] tmp]# java-version

Java Version "1.7.0_25"

Java (TM) SE Runtime Environment (build 1.7.0_25-b15)

Java HotSpot (TM) 64-bit Server VM (build 23.25-b01, Mixed mode)

Step 7: remove the TMP directory under the JDK installation package

Redhat Linux Installation JDK 1.7

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.