Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录

Posted 阿 军

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录相关的知识,希望对你有一定的参考价值。

 

 

[root@localhost /]# systemctl status jenkins.service
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since 六 2019-09-28 09:27:02 CST; 27min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 30069 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)

9月 28 09:27:02 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
9月 28 09:27:02 localhost.localdomain runuser[30074]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
9月 28 09:27:02 localhost.localdomain jenkins[30069]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
9月 28 09:27:02 localhost.localdomain jenkins[30069]: [失败]
9月 28 09:27:02 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
9月 28 09:27:02 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
9月 28 09:27:02 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
9月 28 09:27:02 localhost.localdomain systemd[1]: jenkins.service failed.


[root@localhost /]# which java
/usr/local/iron/jdk1.8.0_191/bin/java

#JDK的安装路径和Jenkins 默认的JDK路径不一致
#建立软连接
ln -s /usr/local/iron/jdk1.8.0_191/jdk/bin/java /usr/bin/java

#如果多版本,可以使用下面的命令更新
[root@localhost /]# update-alternatives --install /usr/bin/java java /usr/local/iron/jdk1.8.0_191/bin/java 300
[root@localhost /]# update-alternatives --install /usr/bin/javac javac /usr/local/iron/jdk1.8.0_191/bin/javac 300
[root@localhost /]# update-alternatives --install /usr/bin/jar jar /usr/local/iron/jdk1.8.0_191/bin/jar 300
[root@localhost /]# update-alternatives --install /usr/bin/javah javah /usr/local/iron/jdk1.8.0_191/bin/javah 300
[root@localhost /]# update-alternatives --install /usr/bin/javap javap /usr/local/iron/jdk1.8.0_191/bin/javap 300
[root@localhost /]# update-alternatives --config java

[root@localhost /]# which java
/usr/bin/java

 


或者修改jenkins配置文件

vi /etc/rc.d/init.d/jenkins

类似如下修改:

candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
/usr/local/iron/jdk1.8.0_191/bin/java #把自己配置的目录加进去
"

 

以上是关于Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录的主要内容,如果未能解决你的问题,请参考以下文章

centos7.4 U盘安装卡在 starting dracut initqueue hook

centos7 U盘安装卡在 starting dracut initqueue hook解决办法

U盘安装Centos7启动过程中出现:starting dracut initqueue hook

centos7 U盘安装卡在 starting dracut initqueue hook

startinghaldaemon卡住

“nacos is starting with standalone“ 此时不应有 acos-server-1.4.1 acos“logsjava_heapdump.hprof -XX:-U