Install
Take jdk1.6.0 _ 43 as an example.
Download jdk-6u43-linux-x64.bin, http://www.oracle.com/technetwork/java/javase/downloads/index.html
Add executable permission chmod + x jdk-6u43-linux-x64.bin,
Run./jdk-6u43-linux-x64.bin to generate directory jdk1.6.0 _ 43
Copy to/usr/share, MV jdk1.6.0 _ 43/usr/share
In addition, the jdk-6u43-linux-x64.bin decompress all files to the JDK $ verison _ $ update directory of the current directory,
Jdk-6u43-linux-x64-rpm.bin decompress to generate RPM package,Run the rpm-IVH command to install
Configure Environment Variables
Add under/etc/profile
# Set Java environment
Java_home =/usr/share/jdk1.6.0 _ 43
Path = $ java_home/bin: $ path
Classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Export java_home
Export path
Export classpath
Test
[Root @ localhost ~] # Echo $ java_home
/Usr/share/jdk1.6.0 _ 43
[Root @ localhost ~] # Echo $ path
/Usr/share/jdk1.6.0 _ 43/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin: /usr/sbin:/usr/bin:/root/bin
[Root @ localhost ~] # Echo $ classpath
.:/Usr/share/jdk1.6.0 _ 43/lib/dt. jar:/usr/share/jdk1.6.0 _ 43/lib/tools. Jar
[Root @ localhost ~] # Java-version
Java version "1.6.0 _ 43"
Java (TM) se Runtime Environment (build 1.6.0 _ 43-b01)
Java hotspot (TM) 64-bit server VM (build pipeline 14-b01, mixed mode)