原因:jenkins安装新版本时发现不支持java8了, 需要手动删除旧的8更新到11, 再配置环境变量.
报错:jenkins: invalid Java version: openjdk version "1.8.0_312"
1.先卸载旧的java8
dnf remove java
2.安装装版本java11
yum install -y fontconfig java-11-openjdk java-11-openjdk-devel.x86_64
3.修复环境变量
#查看当前java环境,如果是java-1.8.0-openjdk-1.8.0.312.b07-1.el8_4.x86_64是错误的,需要删掉重建
ls -l $(which java)
ls -lr /usr/bin/java
ls -lrt /etc/alternatives/java
rm /etc/alternatives/java
ln -s /usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.el8_4.x86_64/bin/java /etc/alternatives/java
ll /etc/alternatives/java
#修复环境变量
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.el8_4.x86_64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
4.重启jenkins发现正常启动了
systemctl restart jenkins.service
标签:11,Java11,lib,java,openjdk,JAVA,HOME,Java8,java11 From: https://www.cnblogs.com/zhaolongisme/p/17341080.html