Starting Jenkins bash: /usr/bin/java: No such file or directory Starting Jenkins bash: /usr/bin/java: No such file or directory jenkins jenkins

Starting Jenkins bash: /usr/bin/java: No such file or directory


Jenkins needs java to start and in your case in /usr/bin/ directory java is not available

If you go to /etc/init.d/ and open jenkins file you will find:

candidates="/etc/alternatives/java/usr/lib/jvm/java-1.6.0/bin/java/usr/lib/jvm/jre-1.6.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-1.8.0/bin/java/usr/lib/jvm/jre-1.8.0/bin/java/usr/bin/java"

These are the paths where jenkins looks for java, and in your case java was not present in any of the above paths.

So look for the path where you are having java and add that path in the above jenkins file.

Since you are having java in /opt/jdk/bin, then add this in jenkins file:

    candidates="/opt/jdk/bin/java <----Add here /etc/alternatives/java/usr/lib/jvm/java-1.6.0/bin/java/usr/lib/jvm/jre-1.6.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-1.8.0/bin/java/usr/lib/jvm/jre-1.8.0/bin/java/usr/bin/java"


Try fix it by using:

ln -s /opt/jdk/bin/java /usr/bin/java

The script file who service utility is using is probably /etc/init.d/jenkinsYou could edit this file too...