下载新版本的jdk-6u25-linux-i586.bin,执行后拷贝到/usr下。
使用[root@we]# chmod +x jdk-6u25-linux-i586.bin
[root@we]# ./ jdk-6u25-linux-i586.bin
来安装jdk然后在/etc/profile中设置环境变量:
JAVA_HOME=/usr/jdk1.6.0_25(其中jdk1.6.0_25是安装JDK后自动生成的JDK安装文件所在的文件夹名称)
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export JAVA_HOME PATH CLASSPATH
这是后JDK1.6安装完成,然后java -version一下啊问题来了竟然显示的是:
java version “1.4.2″
gij (GNU libgcj) version 4.1.1 20070105 (Red Hat4.1.1-52)
Copyright (C) 2006 FreeSoftware Foundation, Inc.
This is free software; see the source for copyingconditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE
怎么办呢?????如下解决方案:
[root@we]#ll /usr/bin/java
lrwxrwxrwx 1 root root 22 Dec 9 2007 /usr/bin/java-> /etc/alternatives/java
[root@we]# java -version
java version “1.4.2″
gij (GNU libgcj) version 4.1.1 20070105 (Red Hat 4.1.1-52)
Copyright (C) 2006 FreeSoftware 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@we]# ll /etc/alternatives/java
lrwxrwxrwx 1 root root 35 Dec 9 2007/etc/alternatives/java -> /usr/lib/jvm/jre-1.4.2-gcj/bin/java
[root@web2 local]# rpm -qa|grep java
libgtk-java-2.8.7-3.el5
glib-java-0.2.6-3.fc6
libgconf-java-2.12.4-6.el5
cairo-java-1.0.5-3.fc6
java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
[root@we]# rpm -qf/usr/lib/jvm/jre-1.4.2-gcj/bin/java
java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
[root@we]# rm -f /usr/bin/java
[root@we]# rm cd /usr/bin
[root@we]# ln -s /usr/jdk1.6.0/bin/java/usr/bin/java(其中jdk1.6.0是jdk的安装目录,这里重定向了java以及javac的软连接)
[root@we]# ln -s /usr/jdk1.6.0/bin/javac/usr/bin/javac(其中jdk1.6.0是jdk的安装目录,这里重定向了java以及javac的软连接)
[root@we]# java -version
java version “1.6.0_11″
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode)
祝你好运。。。。