java.io.IOException: Cannot run program "sh" (in directory "d:\.hudson\jobs\55\workspace\default"): CreateProcess error=2, The system cannot find the file specified

Jenkins JIRA | ilyaromanenko | 8 years ago
  1. 0

    When i create multi-configuration project with windows-batch file step - it will not execute. It trying to call some .sh file but actually i don't know why here is log: [default] $ sh -xe C:\DOCUME~1\ILLIA~1.ROM\LOCALS~1\Temp\hudson271712687449516661.sh The system cannot find the file specified FATAL: command execution failed java.io.IOException: Cannot run program "sh" (in directory "d:\.hudson\jobs\55\workspace\default"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:132) at hudson.Proc$LocalProc.<init>(Proc.java:110) at hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:359) at hudson.Launcher$LocalLauncher.launch(Launcher.java:342) at hudson.Launcher.launch(Launcher.java:175) at hudson.Launcher.launch(Launcher.java:127) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:84) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58) at hudson.model.Build$RunnerImpl.build(Build.java:195) at hudson.model.Build$RunnerImpl.doRun(Build.java:151) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:272) at hudson.model.Run.run(Run.java:899) at hudson.model.Build.run(Build.java:112) at hudson.model.ResourceController.execute(ResourceController.java:93) at hudson.model.Executor.run(Executor.java:119) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 16 more When i create simple project it works fine

    Jenkins JIRA | 8 years ago | ilyaromanenko
    java.io.IOException: Cannot run program "sh" (in directory "d:\.hudson\jobs\55\workspace\default"): CreateProcess error=2, The system cannot find the file specified
  2. 0

    When i create multi-configuration project with windows-batch file step - it will not execute. It trying to call some .sh file but actually i don't know why here is log: [default] $ sh -xe C:\DOCUME~1\ILLIA~1.ROM\LOCALS~1\Temp\hudson271712687449516661.sh The system cannot find the file specified FATAL: command execution failed java.io.IOException: Cannot run program "sh" (in directory "d:\.hudson\jobs\55\workspace\default"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:132) at hudson.Proc$LocalProc.<init>(Proc.java:110) at hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:359) at hudson.Launcher$LocalLauncher.launch(Launcher.java:342) at hudson.Launcher.launch(Launcher.java:175) at hudson.Launcher.launch(Launcher.java:127) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:84) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58) at hudson.model.Build$RunnerImpl.build(Build.java:195) at hudson.model.Build$RunnerImpl.doRun(Build.java:151) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:272) at hudson.model.Run.run(Run.java:899) at hudson.model.Build.run(Build.java:112) at hudson.model.ResourceController.execute(ResourceController.java:93) at hudson.model.Executor.run(Executor.java:119) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 16 more When i create simple project it works fine

    Jenkins JIRA | 8 years ago | ilyaromanenko
    java.io.IOException: Cannot run program "sh" (in directory "d:\.hudson\jobs\55\workspace\default"): CreateProcess error=2, The system cannot find the file specified
  3. 0

    AppTest fails under windows. analysis: changing the the offending test assert from assertTrue(s.contains("+ echo hello")); to assertTrue(s,s.contains("+ echo hello")); to show more information. Rerun and the test log contains ---------- ------------------------------------------------------------------------------- Test set: org.jvnet.hudson.main.AppTest ------------------------------------------------------------------------------- Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.781 sec <<< FAILURE! test1(org.jvnet.hudson.main.AppTest) Time elapsed: 0.281 sec <<< FAILURE! junit.framework.AssertionFailedError: started [workspace] $ sh -xe C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31019.sh FATAL: command execution failed java.io.IOException: Cannot run program "sh" (in directory "C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31014test\jobs\test\workspace"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:459) at hudson.Proc$LocalProc.<init>(Proc.java:104) at hudson.Proc$LocalProc.<init>(Proc.java:82) at hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:311) at hudson.Launcher$LocalLauncher.launch(Launcher.java:302) at hudson.Launcher.launch(Launcher.java:140) at hudson.Launcher.launch(Launcher.java:92) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:34) at hudson.model.Build$RunnerImpl.build(Build.java:138) at hudson.model.Build$RunnerImpl.doRun(Build.java:113) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:241) at hudson.model.Run.run(Run.java:817) at hudson.model.Build.run(Build.java:88) at hudson.model.ResourceController.execute(ResourceController.java:70) at hudson.model.Executor.run(Executor.java:88) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:81) at java.lang.ProcessImpl.start(ProcessImpl.java:30) at java.lang.ProcessBuilder.start(ProcessBuilder.java:452) ... 15 more finished: FAILURE at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.assertTrue(Assert.java:20) at org.jvnet.hudson.main.AppTest.meat(AppTest.java:38) at org.jvnet.hudson.main.AppTest.test1(AppTest.java:19) ---------- therefore the problem is that the test adds a Shell action which doesn't work under windows. Fix: If running under windows, use a BatchFile action instead of a shell action. In this case the log contains "echo hello" but not "+ echo hello" so change the assert subtly to match both cases.

    Jenkins JIRA | 8 years ago | brucechapman
    java.io.IOException: Cannot run program "sh" (in directory "C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31014test\jobs\test\workspace"): CreateProcess error=2, The system cannot find the file specified
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    AppTest fails under windows. analysis: changing the the offending test assert from assertTrue(s.contains("+ echo hello")); to assertTrue(s,s.contains("+ echo hello")); to show more information. Rerun and the test log contains ---------- ------------------------------------------------------------------------------- Test set: org.jvnet.hudson.main.AppTest ------------------------------------------------------------------------------- Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.781 sec <<< FAILURE! test1(org.jvnet.hudson.main.AppTest) Time elapsed: 0.281 sec <<< FAILURE! junit.framework.AssertionFailedError: started [workspace] $ sh -xe C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31019.sh FATAL: command execution failed java.io.IOException: Cannot run program "sh" (in directory "C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31014test\jobs\test\workspace"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:459) at hudson.Proc$LocalProc.<init>(Proc.java:104) at hudson.Proc$LocalProc.<init>(Proc.java:82) at hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:311) at hudson.Launcher$LocalLauncher.launch(Launcher.java:302) at hudson.Launcher.launch(Launcher.java:140) at hudson.Launcher.launch(Launcher.java:92) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:60) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:34) at hudson.model.Build$RunnerImpl.build(Build.java:138) at hudson.model.Build$RunnerImpl.doRun(Build.java:113) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:241) at hudson.model.Run.run(Run.java:817) at hudson.model.Build.run(Build.java:88) at hudson.model.ResourceController.execute(ResourceController.java:70) at hudson.model.Executor.run(Executor.java:88) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:81) at java.lang.ProcessImpl.start(ProcessImpl.java:30) at java.lang.ProcessBuilder.start(ProcessBuilder.java:452) ... 15 more finished: FAILURE at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.assertTrue(Assert.java:20) at org.jvnet.hudson.main.AppTest.meat(AppTest.java:38) at org.jvnet.hudson.main.AppTest.test1(AppTest.java:19) ---------- therefore the problem is that the test adds a Shell action which doesn't work under windows. Fix: If running under windows, use a BatchFile action instead of a shell action. In this case the log contains "echo hello" but not "+ echo hello" so change the assert subtly to match both cases.

    Jenkins JIRA | 8 years ago | brucechapman
    java.io.IOException: Cannot run program "sh" (in directory "C:\DOCUME~1\bchapman\LOCALS~1\Temp\hudson31014test\jobs\test\workspace"): CreateProcess error=2, The system cannot find the file specified
  6. 0

    How to Run job on Jenkins with Selenium Server

    Stack Overflow | 1 year ago | Khalid Ksouri
    java.io.IOException: Cannot run program "cmd" (in directory "/appli/projects/jenkins_atos/jenkins/workspace/STM_V1_V2_TESTS"): java.io.IOException: error=2, No such file or directory

  1. eti22 1 times, last 1 month ago
  2. asdasd 24 times, last 3 months ago
  3. rexgreenza 8 times, last 3 months ago
  4. Benj-AD 1 times, last 4 months ago
  5. Akshay 4 times, last 6 months ago
95 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

    CreateProcess error=2, The system cannot find the file specified

    at java.lang.ProcessImpl.create()
  2. Java RT
    ProcessBuilder.start
    1. java.lang.ProcessImpl.create(Native Method)
    2. java.lang.ProcessImpl.<init>(Unknown Source)
    3. java.lang.ProcessImpl.start(Unknown Source)
    4. java.lang.ProcessBuilder.start(Unknown Source)
    4 frames
  3. Hudson
    Executor.run
    1. hudson.Proc$LocalProc.<init>(Proc.java:132)
    2. hudson.Proc$LocalProc.<init>(Proc.java:110)
    3. hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:359)
    4. hudson.Launcher$LocalLauncher.launch(Launcher.java:342)
    5. hudson.Launcher.launch(Launcher.java:175)
    6. hudson.Launcher.launch(Launcher.java:127)
    7. hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:84)
    8. hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58)
    9. hudson.model.Build$RunnerImpl.build(Build.java:195)
    10. hudson.model.Build$RunnerImpl.doRun(Build.java:151)
    11. hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:272)
    12. hudson.model.Run.run(Run.java:899)
    13. hudson.model.Build.run(Build.java:112)
    14. hudson.model.ResourceController.execute(ResourceController.java:93)
    15. hudson.model.Executor.run(Executor.java:119)
    15 frames