linux 安装jdk1.7

Welcome read !

下载 jdk7

1
2
$ cd /app/jdk/jdk7/
$ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://120.52.72.24/download.oracle.com/c3pr90ntc0td/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz

jdk7官方网站

解压

1
2
$ sudo tar zxvf ./jdk-7u79-linux-x64.tar.gz
$ tar zxvf ./jdk-7u79-linux-x64.tar.gz

配置环境变量

1
2
3
4
5
6
7
8
9
$ vim /etc/profile
新增配置:
export JAVA_HOME=/app/jdk/jdk7/jdk1.7.0_79
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
$ source /etc/profile
$ java -version

tomcat rs.sh

1
2
3
4
5
6
export JAVA_HOME='/app/jdk/jdk7/jdk1.7.0_79'
ps -ef |grep tomcat |awk '{print $2}'|xargs kill -9
echo "tomcat shutdown!!"
sleep 0.5
/app/tomcat/apache-tomcat-7.0.63/bin/catalina.sh start
echo "restart ok!!"