标签:
1,下载jdk-7u75-linux-x64.tar.gz,地址http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
2,确定系统是否自带jdk,如果自带,最好先卸载,卸载方法参见另一篇博文 卸载Centos自带open-jdk
3,切换到root用户,新建 /usr/local/java 目录,并将安装包上传到该目录
#su root
#mkdir /usr/local/java
4,解压 jdk-7u79-linux-x64.tar.gz
# tar xvf jdk-7u79-linux-x64.tar.gz
5,设置环境变量,编辑/etc/profile文件,在最下面 追加 jdk安装路径
#vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.7.0_79
export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre
export PATH=$PATH:/usr/local/java/jdk1.7.0_79/bin
export CLASSPATH=./:/usr/local/java/jdk1.7.0_79/lib:/usr/local/java/jdk1.7.0_79/jre/lib
6,设置环境变量生效,
#source profile
7,校验是否安装成功
#java -version
标签:
原文地址:http://www.cnblogs.com/liuxiuhao/p/5656965.html