zoukankan      html  css  js  c++  java
  • 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 #把自己配置的目录加进去
    "
  • 相关阅读:
    使用office制作图章公章
    Office英语学习好帮手
    office快速制作简历
    如何使用office2010插入屏幕截图
    office 2010 安装教程
    360wifi使用方法|360wifi使用教程
    在我的电脑里新加一个盘符来隐藏文件夹和文件和秘密
    必应词典3.2去广告备忘笔记(转摘于roustar31)
    ASProtect注册码使用教程|ASProtect SKE(加壳脱壳工具) 2.56 汉化注册版
    ISTool5.3.1汉化版使用教程
  • 原文地址:https://www.cnblogs.com/vipsoft/p/11601835.html
Copyright © 2011-2022 走看看