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

     

     

    [[email protected] /]# 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
    
    #如果多版本,可以使用下面的命令更新
    [[email protected] /]# update-alternatives --install /usr/bin/java java /usr/local/iron/jdk1.8.0_191/bin/java 300
    [[email protected] /]# update-alternatives --install /usr/bin/javac javac /usr/local/iron/jdk1.8.0_191/bin/javac 300
    [[email protected] /]# update-alternatives --install /usr/bin/jar jar /usr/local/iron/jdk1.8.0_191/bin/jar 300
    [[email protected] /]# update-alternatives --install /usr/bin/javah javah /usr/local/iron/jdk1.8.0_191/bin/javah 300
    [[email protected] /]# update-alternatives --install /usr/bin/javap javap /usr/local/iron/jdk1.8.0_191/bin/javap 300
    [[email protected] /]# 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 #把自己配置的目录加进去 "
    相关文章
    相关标签/搜索
    4887铁算王中王开奖结果小说 泸溪县| 天津市| 营山县| 渝北区| 饶平县| 台湾省| 宾阳县| 遵义县| 庆城县| 遵义县| 纳雍县| 丁青县| 同仁县| 桂平市| 两当县| 紫云| 红桥区| 武汉市| 平和县| 乌苏市| 紫阳县| 湖北省| 荔浦县| 林芝县| 成安县| 襄垣县| 华宁县| 扶风县| 清镇市| 渝中区| 武功县| 平潭县| 城步| 喀喇沁旗| 嵊泗县| 黄陵县| 晋中市| http://fa.hz0j0r9vo.fun http://fa.hz0j0r3vo.fun http://fa.hz0j1r7vo.fun http://fa.hz0j0r4vo.fun http://fa.hz0j0r9vo.fun