1. download the latest j2se 1.6: jdk-6u17-linux-i586-rpm.bin from java.sun.com
2. Copy the JDK Installation File jdk-6u17-linux-i586-rpm.bin to any directory of RedHat. Example:/opt/JDK (directory JDK needs to be manually created)
3. Execute # chmod + x jdk-6u17-linux-i586-rpm.bin
4. Execute./jdk-6u17-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-6u17-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-6u17-linux-i586.rpm
7. Execute rpm-IVH jdk-6u17-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. In the Java directory, you can find the JDK 1.6.0 _ 17 folder, which is used to set environment variables.
8. Set Environment Variables
A. Enter the/etc folder (the specific operation command is ignored), locate 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.6.0 _ 17"
[Note: "=" cannot contain spaces on both sides]
Export classpath = "/usr/Java/jdk1.6.0 _ 17/lib:/usr/Java/jdk1.6.0 _ 17/JRE/lib"
[Note: "=" cannot contain spaces on both sides. ":" Is a colon, and do not contain spaces.]
Pathmunge/usr/Java/jdk1.6.0 _ 17/bin:/usr/Java/jdk1.6.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.6.0.17" appears, it indicates that your JDK has been installed successfully! Congratulations!
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.