问题描述

在CentOS 6.5上启动Jenkins 

service jenkins start

报错

Starting Jenkins bash: /usr/bin/java: No such file or directory
                                                       [FAILED]
问题分析

JDK的安装路径和Jenkins 默认的JDK路径不一致

[root@iZbp14w0b2rs7i1400bjjmZ ~]# echo $JAVA_HOME
/usr/local/jdk1.8.0_121/jdk
[root@iZbp14w0b2rs7i1400bjjmZ ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/jdk1.8.0_121/jdk/bin:/root/bin
[root@iZbp14w0b2rs7i1400bjjmZ ~]# which java
/usr/local/jdk1.8.0_121/jdk/bin/java

问题解决

建立软连接

ln -s /usr/local/jdk1.8.0_121/jdk/bin/java /usr/bin/java

使用which java验证,发现地址已经改变

[root@iZbp14w0b2rs7i1400bjjmZ ~]# which java
/usr/bin/java

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐