java.io.IOException: Cannot run program "env": CreateProcess error=2, The system cannot find the file specified

Apache's JIRA Issue Tracker | Nilay Chheda | 12 months 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

    While trying to run EXIFTool Parser using Tika on Windows OS, we are getting following error output. (Ref: http://wiki.apache.org/tika/EXIFToolParser) java.io.IOException: Cannot run program "env": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at org.apache.tika.parser.external.ExternalParser.parse(ExternalParser.java:182) at org.apache.tika.parser.external.ExternalParser.parse(ExternalParser.java:145) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) at org.apache.tika.parser.ParserDecorator.parse(ParserDecorator.java:177) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120) at org.apache.tika.cli.TikaCLI$OutputType.process(TikaCLI.java:190) at org.apache.tika.cli.TikaCLI.process(TikaCLI.java:491) at org.apache.tika.cli.TikaCLI.main(TikaCLI.java:144) 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) ... 13 more Exception in thread "main" org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.external.ExternalParser@51efea79 at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:282) at org.apache.tika.parser.ParserDecorator.parse(ParserDecorator.java:177) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120) at org.apache.tika.cli.TikaCLI$OutputType.process(TikaCLI.java:190) at org.apache.tika.cli.TikaCLI.process(TikaCLI.java:491) at org.apache.tika.cli.TikaCLI.main(TikaCLI.java:144) Caused by: java.lang.NullPointerException at org.apache.tika.parser.external.ExternalParser.parse(ExternalParser.java:218) at org.apache.tika.parser.external.ExternalParser.parse(ExternalParser.java:145) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) ... 7 more After analyzing the stack trace and little experimentation, we found that "env" is unix/Mac OS X/Linux specific command and does not work on Windows. We were able to workaround this problem by adding some Windows specific code, recompile Tika and run again with similar setup. I am attaching the original file and modified file for review. If fix is acceptable by Tika specific standards, I can send the pull request on Github to contribute the patch.

    Apache's JIRA Issue Tracker | 12 months ago | Nilay Chheda
    java.io.IOException: Cannot run program "env": CreateProcess error=2, The system cannot find the file specified
  2. 0

    R Pluging Error

    GitHub | 2 years ago | sirinath
    javax.servlet.ServletException: java.io.IOException: Cannot run program "Rscript": CreateProcess error=2, The system cannot find the file specified
  3. 0

    Matlab 2014b error

    GitHub | 2 years ago | geebioso
    java.io.IOException: Cannot run program "make" (in directory "C:\Users\Garren\Dropbox\cmdstan-2.5.0\cmdstan"): 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

    Apktool fails with Ice Cream Sandwich apks ?

    GitHub | 2 years ago | iBotPeaches
    brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\TSTEVE~1\AppData\Local\Temp\APKTOOL8051116276507598928.tmp, -I, C:\Users\tstevenson\apktool\framework\1.apk, -S, C:\Users\tstevenson\Documents\Dropbox\Phone\Working\xdaAutoTool\_INPUT_APK\SystemUI\res, -M, C:\Users\tstevenson\Documents\Dropbox\Phone\Working\xdaAutoTool\_INPUT_APK\SystemUI\AndroidManifest.xml]
  6. 0

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

    Stack Overflow | 3 years ago | Trijit
    java.io.IOException: Cannot run program "winrar" (in directory "C:\Program Files\WinRAR"): CreateProcess error=2, The system cannot find the file specified

  1. PKeidel 3 times, last 3 months ago
  2. serious2monkeys 1 times, last 4 months ago
  3. Handemelindo 6 times, last 5 months ago
  4. kid 5 times, last 5 months ago
  5. rp 2 times, last 5 months ago
4 more registered users
75 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
    Runtime.exec
    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)
    5. java.lang.Runtime.exec(Unknown Source)
    6. java.lang.Runtime.exec(Unknown Source)
    6 frames
  3. Apache Tika core
    AutoDetectParser.parse
    1. org.apache.tika.parser.external.ExternalParser.parse(ExternalParser.java:182)
    2. org.apache.tika.parser.external.ExternalParser.parse(ExternalParser.java:145)
    3. org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
    4. org.apache.tika.parser.ParserDecorator.parse(ParserDecorator.java:177)
    5. org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
    6. org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
    7. org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
    7 frames
  4. Tika application
    TikaCLI.main
    1. org.apache.tika.cli.TikaCLI$OutputType.process(TikaCLI.java:190)
    2. org.apache.tika.cli.TikaCLI.process(TikaCLI.java:491)
    3. org.apache.tika.cli.TikaCLI.main(TikaCLI.java:144)
    3 frames