进程生成器 java.io.IOException 错误=2

Process Builder java.io.IOException error=2

我想从我的 Java 应用程序 运行 一个 shell 命令。我已经编译了一个名为 "SRILM" 的软件,当我从 shell 运行 它时,一切正常:

ngram-count -text /home/istanbul/Desktop/snlp_hmm/model.txt -order 3 -lm hoho.lm

然而,当我从我的 Java 应用程序中 运行 它时:

ProcessBuilder lmBuilder = new ProcessBuilder("ngram-count", "-text", modelPath, "-order", "3", "-lm", "hohom.lm");
lmBuilder.directory(new File("/home/istanbul/srilm/bin/i686-m64"));

try {
    final Process lmProcess = lmBuilder.start();
    InputStream is = lmProcess.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null) {
        System.out.println(line);
   }
} catch (IOException e) {
    e.printStackTrace();
}

我收到那个错误:

java.io.IOException: Cannot run program "ngram-count" (in directory "/home/istanbul/srilm/bin/i686-m64"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
    at org.itu.hmm.AlgorithmRunner.evaluate(AlgorithmRunner.java:127)
    at org.itu.hmm.ApplicationRunner.main(ApplicationRunner.java:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
    at java.lang.ProcessImpl.start(ProcessImpl.java:130)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
    ... 7 more

有什么想法吗?

当我 运行 它喜欢它时:

ProcessBuilder lmBuilder = new ProcessBuilder("/home/istanbul/srilm/bin/i686-m64/ngram-count", "-text", modelPath, "-order", "3", "-lm", "/home/istanbul/Desktop/snlp_hmm/j.lm");