1. Software
A) download jdk address, this document sample jdk for jdk-6u32-linux-x64.bin, click here.
B) unless otherwise stated, this document serves as the root user.
2. Installation
A) decompress
# Sh jdk-6u32-linux-x64.bin
B) Copy
# Cp-r jdk1.6.0 _ 32/usr/java
C) check whether the decompression is successful
# Cd/usr/java
#./Bin/java-version
Java version "1.6.0 _ 32"
Java (TM) SE Runtime Environment (build 1.6.0 _ 32-b03)
Java HotSpot (TM) Client VM (build 11.3-b02, mixed mode)
# Java-version
Java version "1.4.2"
Gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)
Copyright (C) 2006 Free Software Foundation, Inc.
The built-in java version is 1.4 and the new java version is 1.6. Therefore, you need to change the environment variable and replace the built-in java
D) Set Environment Variables
# Vi/etc/profile
In the edit box, add the environment variable path under "HISTSIZE = 1000:
JAVA_HOME =/usr/java
PATH = $ PATH: $ JAVA_HOME/bin
CLASSPATH =.: $ JAVA_HOME/lib
JRE_HOME = $ JAVA_HOME/jre
Add the following content under "export path user logname mail hostname histsize inputrc:
Export JAVA_HOME path classpath JRE_HOME
Press Esc to exit the edit box, press Shift +;, and enter wq (write, save, and exit)
# Source/etc/profile
Make environment variables take effect
E) set the symbolic connection between java and javac.
This is to change the default jdk (JDK1.4 by default) to the newly installed jdk 1.6.
# Cd/usr/bin
# Ln-s-f/usr/java/jre/bin/java
# Ln-s-f/usr/java/bin/javac
F) restart the system (or exit and log on again) to make the environment variable take effect.
# Reboot
G) Check Environment Variables
# Echo $ JAVA_HOME
/Usr/java
# Echo $ PATH
/Usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin: // usr/java/bin:/root/bin
# Echo $ CLASSPATH
.:/Usr/java/lib
H) check whether the installation and configuration are successful.
# Java-version
Java version "1.6.0 _ 32"
Java (TM) SE Runtime Environment (build 1.6.0 _ 32-b03)
Java HotSpot (TM) Client VM (build 11.3-b02, mixed mode)