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.
From Mrzhangpan's column