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.