我安装的是redhat 5.4 x86-64操作系统,正备搭建HADOOP集群的测试环境,安装HADOOP需要安装JAVA JDK,然后我从网上下载了jdk1.6的版本,但安装完后版本总是显示1.4.2。下面是安装的过程,安装完后环境变量我也设置了
[root@localhost init.d]# cd /soft
[root@localhost soft]# ls
jdk-6u35-linux-x64-rpm.bin
[root@localhost soft]# ls -l
total 67296
-rw-r----- 1 root root 68834864 Oct 9 17:40 jdk-6u35-linux-x64-rpm.bin
[root@localhost soft]# chmod +x jdk-6u35-linux-x64-rpm.bin
[root@localhost soft]# ./jdk-6u35-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (
[email protected]).
inflating: jdk-6u35-linux-amd64.rpm
inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Installing JavaDB
Preparing... ########################################### [100%]
1:sun-javadb-common ########################################### [ 17%]
2:sun-javadb-core ########################################### [ 33%]
3:sun-javadb-client ########################################### [ 50%]
4:sun-javadb-demo ########################################### [ 67%]
5:sun-javadb-docs ########################################### [ 83%]
6:sun-javadb-javadoc ########################################### [100%]
Java(TM) SE Development Kit 6 successfully installed.
Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation
Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.
For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press Enter to continue.....
Done.
[root@localhost soft]# 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@localhost soft]# cd /usr
[root@localhost usr]# cd java
[root@localhost java]# ls
default jdk1.6.0_35 latest
[root@localhost java]# cd jdk1.6.0_35/
[root@localhost jdk1.6.0_35]# ls
bin COPYRIGHT include jre lib LICENSE man README.html register.html register_ja.html register_zh_CN.html src.zip THIRDPARTYLICENSEREADME.txt
[root@localhost jdk1.6.0_35]# vi /etc/profile
添加以下环境变量
export JAVA_HOME=/usr/java/jdk1.6.0_35
export JAVA_BIN=/usr/java/jdk1.6.0_35/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
然后重新登录root,不记得使环境变量生效的命令了就直接登录的,登录后查看path环境变量
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.6.0_35/bin:/root/bin
说明生效了
然后查看版本
[root@localhost soft]# 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.
直接进入java目录执行还是一样
[root@localhost ~]# cd /usr
[root@localhost usr]# cd java
[root@localhost java]# ls
default jdk1.6.0_35 latest
[root@localhost java]# cd jdk1.6.0_35/
[root@localhost jdk1.6.0_35]# ls
bin COPYRIGHT include jre lib LICENSE man README.html register.html register_ja.html register_zh_CN.html src.zip THIRDPARTYLICENSEREADME.txt
[root@localhost jdk1.6.0_35]# cd bin
[root@localhost bin]# pwd
/usr/java/jdk1.6.0_35/bin
[root@localhost bin]# 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.