Install JDK and set environment variables and RedHat Environment Variables

Source: Internet
Author: User

I. System Environment
Operating System: Redhat Enterprise Linux 5

Ii. Install JDK
1. download the latest j2se 1.5: jdk-1_5_0_17-linux-i586-rpm.bin from java.sun.com
:
Http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-1_5_0_17-linux-i586-rpm.bin? Bundledlineitemuuid = qzlibe. mumyaaaeevv9srjfa & orderid = v_dibe.mwxaaaaeeov9srjfa & productid = uedibe. omzcaaaedklhgb7xo & filename =/jdk-1_5_0_17-linux-i586-rpm.bin

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

3. Execute # chmod + x jdk-1_5_0_17-linux-i586-rpm.bin

4. Execute./jdk-1_5_0_17-linux-i586-rpm.bin
The JDK installation authorization protocol is displayed. You can press enter all the way to browse. If you are impatient, you can press Ctrl + C to directly see Do you agree to the above license terms? [Yes or No.

5. Type yes and agree to the authorization protocol.
At this point the system starts extracting the jdk-1_5_0_17-linux-i586-rpm.bin

6. After decompression, return to the/opt/JDK directory and type dir. We will find an extra unzipped Installation File: jdk-1_5_0_17-linux-i586.rpm

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

8. Set Environment Variables
A. Enter the/etc folder (command: # vi/etc/profile), find the file profile and open it.
[Note: "Profile" indicates that a file is not a folder.]
B. Find the export path user LOGNAME mail hostname histsize inputrc and add the following statement on the statement:
Export java_home = "/usr/Java/jdk1.5.0 _ 17"
[Note: "=" cannot contain spaces on both sides]
Export classpath = ".:/usr/Java/jdk1.5.0 _ 17/lib:/usr/Java/jdk1.5.0 _ 17/JRE/lib"
[Note: "=" cannot contain spaces on both sides. ":" Is a colon, and do not contain spaces.]
Pathmunge/usr/Java/jdk1.5.0 _ 17/bin:/usr/Java/jdk1.5.0 _ 17/JRE/bin
[Note: No quotation marks]

9. Save the file after setting. Restart RedHat and log on to the control terminal. Type Java-version;
If the word "1.5.0.17" appears, it indicates that your JDK has been installed successfully! Congratulations!

Use source/etc/profile to configure and take effect without restarting Linux
 
 
TIPS:
If you do not want to restart the system to make the modified profile take effect, you can press CTRL + ALT + F1/F2 /... /F6 enter the control terminal. If you have not logged on, you can log on directly to enable the modified profile file. If you have logged on, type exit to exit the system and then log on again.

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.