Install and configure JDK under RedHatEnterpriseLinuxServer5.4

Source: Internet
Author: User
I. system environment operating system: RedHatEnterpriseLinuxServer5.4 (rhel5.4) II. Install JDK1. download the latest JavaSEDevelopmentKit7jdk-7-linux-i586.rpm2 from www.oracle.com .&

I. System Environment
Operating System: RedHat Enterprise Linux Server 5.4 (rhel 5.4)

Ii. Install JDK
1. download the latest Java SE Development Kit 7 jdk-7-linux-i586.rpm from www.oracle.com

2. Copy the JDK Installation File jdk-7-linux-i586.rpm to any directory of Redhat. Example:/opt/jdk (directory jdk needs to be manually created)

3. Execute rpm-ivh jdk-1_5_0_17-linux-i586.rpm

In this case, the system starts to install JDK. After the installation, you can find a new folder named java in the/usr directory. This folder is the installed JDK directory.

4. Set Environment Variables
A. Enter the/etc folder, find the file profile, and open it (command: # vi profile ).
B. Find the export path user logname mail hostname histsize inputrc and change it to the following format (insert the editor by I ):
JAVA_HOME = '/usr/java/jdk1.7.0 ′
PATH = $ JAVA_HOME/bin: $ PATH
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export JAVA_HOME
Export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC CLASSPATH

Press ESC to exit the editing mode. Enter wq at the end of the file and press enter to save and exit vi.

5. Save the file after setting. After restarting Redhat (or use source/etc/profile to make the configuration file take effect immediately), log on to the control terminal and enter java-version;
If java version "1.7.0" is displayed, your JDK has been installed successfully!
If the version cannot be displayed normally, it may be because the system comes with JDK 1.4.2.
You must uninstall the SDK before using java-version to view the correct version number.
Rpm-e-nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.i386
Source/etc/profile
Java-version
The correct version number is displayed.

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.