See if the JDK is installed
If the JDK version is not currently installed after installation, you will need to uninstall the JDK version that was originally brought with Linux, because the JDK is installed by default after installing REDHAT9, but the default installation of the jdk1.4 version is older, so you need to uninstall the original Java version first.
[[Email protected]]# java-version View installed Java version information [[Email protected]]# rpm-qa |grep-i Java view Java Installation Status command java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 Uninstall the previously installed jdk1.4 using the RPM-E--nodeps command: [[email protected]] #rpm-e--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 [[Email protected]]# rpm-qa |grep-i java re-enter query Java installation Status command, return value is empty, prove uninstall jdk1.4 success |
Second installation of JDK
1 Download JDK from Oracle's official website
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html
Download latest Version jdk-7u9-linux-i586.rpm
Create a new software folder under/and place the installation package in the/software location [[email protected]] #mkdir/software |
Note:
You should choose a 32-bit or 64-bit JDK installation package based on the number of bits of Linux you use. Get the Linux system to be 32-bit or 64-bit commands:
Getconf Long_bit
32
So Linux needs to download a 32-bit JDK, jdk-7u21linux-i586.rpm
2 Installing the JDK
[[email protected]] #cd/software [[email protected]] #chmod 777 jdk-7u9-linux-i586.rpm//grant JDK-7U9-LINUX-I586.RPM executable permission [[Email protected]]# RPM-IVH jdk-7u9-linux-i586.rpm//install JDK, select Yes to agree to the above protocol, know the installation is complete |
3 Configuring the JDK
Vi/etc/profile//Edit config file, add the following statement in profile profiles Export Java_home=/usr/java/jdk1.7.0_21 Export classpath= $JAVA _home/lib:.: Export path= $PATH:.: $JAVA _home/bin: Source/etc/profile//Make configuration file effective |
4 View JDK default installation path