Jenkins slave unable to figure out java version

Viewed 12911
[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

3 Answers

Check to see which java is on Slave

# which java

Then copy the java path and add it under Advanced configuration of Launch Agents via ssh block.

Manage Jenkins > Manage Nodes and Clouds > Configure node > Advanced section under Launch Agents via ssh block > "update Java path in there"

As Doruk said

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.

However I couldn't find Java under the "Tool locations" option, so the solution that worked for me is to create a link from the java which you do run to the location Jenkins wants.

JAVA_IN=$(which java)
ln -s $JAVA_IN /usr/bin/java
Related