Monday, July 24, 2017

Jenkins slave node gives error /bin/java": java.io.IOException: error=2 when trying to build project

/bin/java": java.io.IOException: error=2
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:476)


As the error indicates the you need to check the environment variables 'JAVA_HOME' or 'java.home' on the slave node. You need to make sure that 'JAVA_HOME' or 'java.home' is pointing to say in linux /opt/common/vendor/jdk1.7.0_79 and not /opt/common/vendor/jdk1.7.0_79/jre.

To check the configuration you can login to Jenkins as admin and then
select Manage Hudson/Jenkins then choose Manage Nodes.
there should be a Node Properties section.
Check the Tool Locations checkbox.
Click on Add/Update then Select your JDK in the dropdown list and add the path to it.

No comments: