系统相关
首页 > 系统相关> > linux的jdk版本更换

linux的jdk版本更换

作者:互联网

jdk版本更换

1.下载安装包
https://www.oracle.com/java/technologies/downloads/archive/
2.上传安装包到java安装路径
3.解压文件夹
cd /usr/java
tar -zxvf jdk-8u102-linux-x64.tar.gz
4.配置环境变量
vi /etc/profile

#增加或修改以下配置
export JAVA_HOME=/usr/java/jdk1.8.0_281
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
5.让配置生效
source /etc/profile
6.测试是否配置成功
[root@localhost java]# java -version
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

tomcat启动或停止依旧使用老版本jdk

1.查看tomcat/bin/catalina.sh
cat /home/apache-tomcat-ja/bin/catalina.sh 

# -----------------------------------------------------------------------------
JAVA_HOME=/usr/java/jdk1.8.0_281
2.查看tomcat/bin/setclasspash.sh
cat /home/apache-tomcat-ja/bin/setclasspath.sh

JAVA_HOME=/usr/java/jdk1.8.0_281
JRE_HOME=/usr/java/jdk1.8.0_281/jre
[root@localhost bin]# ./startup.sh 
Using CATALINA_BASE:   /home/apache-tomcat-ja
Using CATALINA_HOME:   /home/apache-tomcat-ja
Using CATALINA_TMPDIR: /home/apache-tomcat-ja/temp
Using JRE_HOME:        /usr/java/jdk1.8.0_281/jre
Using CLASSPATH:       /home/apache-tomcat-ja/bin/bootstrap.jar:/home/apache-tomcat-ja/bin/tomcat-juli.jar
Tomcat started.

标签:bin,java,jdk,tomcat,home,版本,linux,281,HOME
来源: https://www.cnblogs.com/clearloveblog/p/15845651.html