1.检查是否有旧版本的jdk
[root@localhost soft]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-48)
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]# rpm -qa|grep gcj
libgcj-4.1.2-48.el5
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
libgcj-4.1.2-48.el5
2.卸载旧的jdk
[root@localhost soft]# rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
[root@localhost soft]# java -version
-bash: /usr/bin/java: 没有那个文件或目录
3.后安装新的jdk
./ jdk-1_5_0_15-linux-i586.bin
mkdir /usr/java
mv jdk1.5.0_15 /usr/java/
ln -s /usr/java/jdk1.5.0_16/bin/java /usr/bin/java
ln -s /usr/java/jdk1.5.0_16/bin/javac /usr/bin/javac
4.编写环境变量:
在/etc/profile里写入如下:
#vi /etc/profile
JAVA_HOME=/usr/java/jdk1.5.0_16
JRE_HOME=/usr/java/jdk1.5.0_16/jre
PATH=$PATH:$JAVA_HOME/bin:JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:
export JAVA_HOME JRE_HOME PATH CLASSPATH
export LANG=zh_CN.gb18030
5.使环境变量生效:
#source /etc/profile
@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2011-12-10 10:13
Ke 阅读(2601)
评论(0) 编辑 收藏 所属分类:
linux