Jenkins slave unable to figure out java version

Akash S. picture Akash S. · Mar 21, 2016 · Viewed 7.4k times · Source
[03/21/16 16:09:39] [SSH] Opening SSH connection to 172.18.73.53:22.
[03/21/16 16:09:40] [SSH] Authentication successful.
[03/21/16 16:09:40] [SSH] The remote users environment is:
[03/21/16 16:09:40] [SSH] Checking java version of java
Couldn't figure out the Java version of java

[03/21/16 16:09:41] [SSH] Checking java version of /usr/bin/java
Couldn't figure out the Java version of /usr/bin/java
[03/21/16 16:09:41] [SSH] Checking java version of      /usr/java/default/bin/java
Couldn't figure out the Java version of /usr/java/default/bin/java

I am getting the above error on launching the slave

Answer

Doruk Kutluay picture Doruk Kutluay · Mar 21, 2016

It is trying to execute "/usr/bin/java -version" at first, then "/usr/java/default/bin/java -version" but both commands seem to be failing. This might be caused by wrong tool location on slave. You should first figure out the java executable location on your slave:

which java

Then, under slave configuration on Jenkins, enable "Tool Locations" checkbox and add your correct Java path there and save.