[edgen@rhel54 ~]$ java -version
java version "1.4.2 "
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[edgen@rhel54 ~]$ su
口令:
[root@rhel54 edgen]# mkdir /opt/JDK6
[root@rhel54 edgen]# cd /opt/JDK6
[root@rhel54 JDK6]# ll
总计 0
[root@rhel54 JDK6]# cp ~edgen/Desktop/jdk-6u23-linux-i586.bin .
[root@rhel54 JDK6]# ll
总计 82576
-rw-r--r-- 1 root root 84461758 12-27 22:13 jdk-6u23-linux-i586.bin
[root@rhel54 JDK6]# rm ~edgen/Desktop/jdk-6u23-linux-i586.bin
rm:是否删除 一般文件 “/home/edgen/Desktop/jdk-6u23-linux-i586.bin”?
[root@rhel54 JDK6]# rm ~edgen/Desktop/jdk-6u23-linux-i586.bin
rm:是否删除 一般文件 “/home/edgen/Desktop/jdk-6u23-linux-i586.bin”? y
[root@rhel54 JDK6]# ll
总计 82576
-rw-r--r-- 1 root root 84461758 12-27 22:13 jdk-6u23-linux-i586.bin
[root@rhel54 JDK6]# sh jdk-6u23-linux-i586.bin
.....
.....
.....
Press Enter to continue.....
Done.
[root@rhel54 JDK6]# ll
总计 82584
drwxr-xr-x 10 root root 4096 12-28 00:47 jdk1.6.0_23
-rw-r--r-- 1 root root 84461758 12-27 22:13 jdk-6u23-linux-i586.bin
[root@rhel54 JDK6]# mkdir /usr/java
[root@rhel54 JDK6]# mv -f jdk1.6.0_23/ /usr/java/jdk1.6.0_23
[root@rhel54 JDK6]# cd /usr/java/
[root@rhel54 java]# ll
总计 8
drwxr-xr-x 10 root root 4096 12-28 00:47 jdk1.6.0_23
[root@rhel54 java]# cd jdk1.6.0_23/
[root@rhel54 jdk1.6.0_23]# ll
总计 19068
drwxr-xr-x 2 root root 4096 11-13 08:52 bin
-r--r--r-- 1 root root 3339 11-13 06:46 COPYRIGHT
drwxr-xr-x 7 root root 4096 11-13 08:53 db
drwxr-xr-x 10 root root 4096 11-13 08:52 demo
drwxr-xr-x 3 root root 4096 11-13 08:53 include
drwxr-xr-x 7 root root 4096 12-28 00:46 jre
drwxr-xr-x 3 root root 4096 12-28 00:46 lib
drwxr-xr-x 4 root root 4096 11-13 08:53 man
-r--r--r-- 1 root root 28230 11-13 06:46 README.html
-r--r--r-- 1 root root 25317 11-13 06:46 README_ja.html
-r--r--r-- 1 root root 20663 11-13 06:46 README_zh_CN.html
-r--r--r-- 1 root root 5297 12-28 00:47 register.html
-r--r--r-- 1 root root 6743 12-28 00:47 register_ja.html
-r--r--r-- 1 root root 4900 12-28 00:47 register_zh_CN.html
drwxr-xr-x 9 root root 4096 11-13 08:53 sample
-rw-r--r-- 1 root root 19098236 11-13 06:46 src.zip
-r--r--r-- 1 root root 183173 11-13 06:46 THIRDPARTYLICENSEREADME.txt
[root@rhel54 jdk1.6.0_23]# ./bin/java -version
java version "1.6.0_23 "
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
[root@rhel54 jdk1.6.0_23]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@rhel54 jdk1.6.0_23]# vi /etc/profile
[root@rhel54 jdk1.6.0_23]# cat /etc/profile | grep JAVA_HOME
JAVA_HOME=/usr/java/jdk1.6.0_23
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
[root@rhel54 jdk1.6.0_23]# cat /etc/profile
# /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`
HISTSIZE=1000
JAVA_HOME=/usr/java/jdk1.6.0_23
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
export JAVA_HOME JRE_HOME PATH CLASSPATH
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done
unset i
unset pathmunge
[root@rhel54 jdk1.6.0_23]# cd /usr/bin
[root@rhel54 bin]# ln -s -f /usr/java/jdk1.6.0_23/jre/bin/java
[root@rhel54 bin]# ln -s -f /usr/java/jdk1.6.0_23/bin/javac
[root@rhel54 bin]# echo $JAVA_HOME
[root@rhel54 bin]# source /etc/profile
[root@rhel54 bin]# echo $JAVA_HOME
/usr/java/jdk1.6.0_23
[root@rhel54 bin]# exit
exit
[edgen@rhel54 ~]$ echo $JAVA_HOME
[edgen@rhel54 ~]$ source /etc/profile
[edgen@rhel54 ~]$ echo $JAVA_HOME
/usr/java/jdk1.6.0_23
[edgen@rhel54 ~]$ echo $JRE_HOME
/usr/java/jdk1.6.0_23/jre
[edgen@rhel54 ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/java/jdk1.6.0_23/bin:/home/edgen/bin
[edgen@rhel54 ~]$ echo $CLASSPATH
.:/usr/java/jdk1.6.0_23/lib
[edgen@rhel54 ~]$ java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
[edgen@rhel54 ~]$ ll
总计 8
drwxr-xr-x 2 edgen edgen 4096 12-27 22:14 Desktop
[edgen@rhel54 ~]$ mkdir test
[edgen@rhel54 ~]$ cd test
[edgen@rhel54 test]$ vi HelloWorld.java
[edgen@rhel54 test]$ less HelloWorld.java
[edgen@rhel54 test]$
[edgen@rhel54 test]$ cat HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World! I'am Edgen Huang");
}
}
[edgen@rhel54 test]$ javac HelloWorld.java
[edgen@rhel54 test]$ java HelloWorld
Hello World! I'am Edgen Huang
[edgen@rhel54 test]$ reboot