Java is a requirement to run the remoting process on the Jenkins Agents, currently, there are three methods to find the Java command in the SSH Build Agents:
- Java command is in the PATH.
- Java PATH is set in the javaPath advanced setting.
- Jenkins tries to guess the Java location using some fixed paths and the JENKINS_HOME environment variable.
this last way to find Java try to fix something that should be configured in the Agent environment or in the Agent configuration (the other two options), it does not cover all the possibilities, it is odd, it is not OS independent, in general, is odd and error-prone. For all these, I want to deprecate the use of this configuration option, a warning will show on the agent logs at the start fo a few months, and at the end of 2021, I will remove this option.