1. install JDK: first download the installation package from the sun website: Composer
1. install JDK:
First download the installation package from the sun website:
Https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter
Download: jdk-6u16-linux-i586-rpm.bin and jdk-6u16-linux-i586.bin
Then place the two installation files in the/usr/tmp directory and modify the permissions respectively. the command is as follows:
# Chmod u + x./jdk-6u16-linux-i586.bin
# Chmod u + x./jdk-6u16-linux-i586-rpm.bin
Decompress the file (these two files can be automatically decompressed ):
#./Jdk-6u16-linux-i586.bin
Create directory/usr/java:
# Mkdir/usr/java
Copy the unzipped jdk-6u16-linux-i586 directory to the/usr/java Directory:
# Cp-fr jdk-6u16-linux-i586/usr/java
Decompress the file
#./Jdk-6u16-linux-i586-rpm.bin
The installation software automatically installs JDK under the/usr/java/jdk-6u16-linux-i586 Directory
2. configure environment variables
1. modify user environment variables
Assume that the user using java is guest, and edit the user's. bashrc file to set environment variables.
# Vi/home/guest/. bashrc
Add the following to the. bashrc file:
Export JAVA_HOME =/usr/java/jdk1.6.0 _ 16
Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH: $ HOMR/bin
2. modify the environment variables of all users
# Vi/etc/profile
Add:
Export JAVA_HOME =/usr/java/jdk1.6.0 _ 16
Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH: $ HOMR/bin
Note that $ CLASSPATH is added to the CLASSPATH path to avoid overwriting the previously configured path.
The profile file is as follows:
########### Profile begin ###########
#/Etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in/etc/bashrc
Pathmunge (){
If! Echo $ PATH |/bin/egrep-q "(^ |:) $1 ($ |:)"; then
If ["$2" = "after"]; then
PATH = $ PATH: $1
Else
PATH = $1: $ PATH
Fi
Fi
}
# Ksh workaround
If [-z "$ EUID"-a-x/usr/bin/id]; then
EUID = 'id-U'
UID = 'id-ru'
Fi
# Path manipulation
If ["$ EUID" = "0"]; then
Pathmunge/sbin
Pathmunge/usr/sbin
Pathmunge/usr/local/sbin
Fi
# No core files by default
Ulimit-S-c 0>/dev/null 2> & 1
If [-x/usr/bin/id]; then
USER = "'id-un '"
LOGNAME = $ USER
MAIL = "/var/spool/mail/$ USER"
Fi
HOSTNAME = '/bin/hostname'
History size = 1000
If [-z "$ INPUTRC"-! -F "$ HOME/. inputrc"]; then
INPUTRC =/etc/inputrc
Fi
Export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
# Java path
Export JAVA_HOME =/usr/java/jdk1.6.0 _ 16
Export CLASSPATH = $ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib
Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH: $ HOMR/bin
For I in/etc/profile. d/*. sh; do
If [-r "$ I"]; then
. $ I
Fi
Done
Unset I
Unset pathmunge
############ Profile end ###########
III. uninstall jkd:
1. uninstall the built-in jdk Version:
View the built-in jdk:
# Rpm-qa | grep gcj
The following information is displayed:
Libgcj-4.1.2-44.el5
Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Run the rpm-e -- nodeps command to delete the content found above:
# Rpm-e? Cnodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
2. uninstall the jkd version installed by rpm
View the installed jdk:
# Rpm-qa | grep jdk
The following information is displayed:
Java-1.6.0-openjdk-1.6.0.0-0.25.b09.el5
Jdk-1.6.0_16-fcs
Uninstall:
# Rpm-e -- nodeps jdk-1.6.0_16-fcs