java.io.IOException: Cannot run program "ant" (in directory "/home/xxx/jenkins/workspace/aixtest"): error=2, A file or directory in the path name does not exist.

Jenkins JIRA | Fred G | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm trying to execute an Ant build script on a AIX slave where I don't have administrator rights. JAVA_HOME and ANT_HOME are not set by default, so I had to set them (and add them to PATH) in the node configuration. I deliberately did not configure an Ant installation, neither on the master nor on the slave. This is the stacktrace that I'm seeing: {code} [aixtest] $ ant -version FATAL: command execution failed.Maybe you need to configure the job to choose one of your Ant installations? java.io.IOException: Cannot run program "ant" (in directory "/home/xxx/jenkins/workspace/aixtest"): error=2, A file or directory in the path name does not exist. at java.lang.ProcessBuilder.start(ProcessBuilder.java:471) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:707) at hudson.Launcher$ProcStarter.start(Launcher.java:338) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:932) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:899) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314) at java.util.concurrent.FutureTask.run(FutureTask.java:149) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919) at java.lang.Thread.run(Thread.java:738) Caused by: java.io.IOException: error=2, A file or directory in the path name does not exist. at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:53) at java.lang.ProcessImpl.start(ProcessImpl.java:112) at java.lang.ProcessBuilder.start(ProcessBuilder.java:464) ... 15 more {code} Oddly enough, if I add an "Execute shell command" build step right before the Ant build step with the command "ant -version" it works: {code} [aixtest] $ /bin/sh -xe /tmp/hudson5535938035142068913.sh + ant -version Apache Ant(TM) version 1.9.2 compiled on July 8 2013 {code} I debugged both the shell command and the ant execution but could not find any obvious difference. Both are calling something like: {code} launcher.launch().cmds(args).envs(env).stdout(aca).pwd(buildFilePath.getParent()).join(); {code} In both cases the environment variables seem to be set correctly.

    Jenkins JIRA | 3 years ago | Fred G
    java.io.IOException: Cannot run program "ant" (in directory "/home/xxx/jenkins/workspace/aixtest"): error=2, A file or directory in the path name does not exist.
  2. 0

    I'm trying to execute an Ant build script on a AIX slave where I don't have administrator rights. JAVA_HOME and ANT_HOME are not set by default, so I had to set them (and add them to PATH) in the node configuration. I deliberately did not configure an Ant installation, neither on the master nor on the slave. This is the stacktrace that I'm seeing: {code} [aixtest] $ ant -version FATAL: command execution failed.Maybe you need to configure the job to choose one of your Ant installations? java.io.IOException: Cannot run program "ant" (in directory "/home/xxx/jenkins/workspace/aixtest"): error=2, A file or directory in the path name does not exist. at java.lang.ProcessBuilder.start(ProcessBuilder.java:471) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:707) at hudson.Launcher$ProcStarter.start(Launcher.java:338) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:932) at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:899) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314) at java.util.concurrent.FutureTask.run(FutureTask.java:149) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919) at java.lang.Thread.run(Thread.java:738) Caused by: java.io.IOException: error=2, A file or directory in the path name does not exist. at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:53) at java.lang.ProcessImpl.start(ProcessImpl.java:112) at java.lang.ProcessBuilder.start(ProcessBuilder.java:464) ... 15 more {code} Oddly enough, if I add an "Execute shell command" build step right before the Ant build step with the command "ant -version" it works: {code} [aixtest] $ /bin/sh -xe /tmp/hudson5535938035142068913.sh + ant -version Apache Ant(TM) version 1.9.2 compiled on July 8 2013 {code} I debugged both the shell command and the ant execution but could not find any obvious difference. Both are calling something like: {code} launcher.launch().cmds(args).envs(env).stdout(aca).pwd(buildFilePath.getParent()).join(); {code} In both cases the environment variables seem to be set correctly.

    Jenkins JIRA | 3 years ago | Fred G
    java.io.IOException: Cannot run program "ant" (in directory "/home/xxx/jenkins/workspace/aixtest"): error=2, A file or directory in the path name does not exist.
  3. 0

    'docker build' fails on Linux Jenkins slave with jenkins 1.590

    GitHub | 2 years ago | gcarre
    java.io.IOException: Cannot run program "docker" (in directory "\home\jenkins\jenkins\workspace\gcarre\docker"): error=2, No such file or directory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    problems with hg plugin

    Google Groups | 5 years ago | Matt Fair
    java.io.IOException: Cannot run program "hg" (in directory "...."): error=2, No such file or directory
  6. 0

    [JENKINS-24788] Cannot run program "/bin/java" on maven 3 projects - Jenkins JIRA

    jenkins-ci.org | 8 months ago
    java.io.IOException: Cannot run program "/bin/java" (in directory "/shn/builder/workspace/build-shnproxy-trunk"): java.io.IOException: error=2, No such file or directory

  1. rp 1 times, last 2 months ago
  2. michallos 1 times, last 3 months ago
  3. eti22 1 times, last 4 months ago
  4. asdasd 24 times, last 5 months ago
  5. rexgreenza 8 times, last 5 months ago
2 more registered users
93 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.io.IOException

    error=2, A file or directory in the path name does not exist.

    at java.lang.UNIXProcess.forkAndExec()
  2. Java RT
    ProcessBuilder.start
    1. java.lang.UNIXProcess.forkAndExec(Native Method)
    2. java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
    3. java.lang.ProcessImpl.start(ProcessImpl.java:112)
    4. java.lang.ProcessBuilder.start(ProcessBuilder.java:464)
    4 frames
  3. Hudson
    Launcher$RemoteLaunchCallable.call
    1. hudson.Proc$LocalProc.<init>(Proc.java:244)
    2. hudson.Proc$LocalProc.<init>(Proc.java:216)
    3. hudson.Launcher$LocalLauncher.launch(Launcher.java:707)
    4. hudson.Launcher$ProcStarter.start(Launcher.java:338)
    5. hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:932)
    6. hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:899)
    6 frames
  4. Hudson :: Remoting Layer
    InterceptingExecutorService$1.call
    1. hudson.remoting.UserRequest.perform(UserRequest.java:118)
    2. hudson.remoting.UserRequest.perform(UserRequest.java:48)
    3. hudson.remoting.Request$2.run(Request.java:287)
    4. hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    4 frames
  5. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:149)
    3. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
    5. java.lang.Thread.run(Thread.java:738)
    5 frames