title: Why I am I getting error = 2 no such file or directory for ProcessBuilder
body: <p>I was recently making a program that gave command line inputs using ProcessBuilder but whenever I run my command I am getting this error message: </p>
  
  <pre><code>java.io.IOException: Cannot run program "convert" (in directory "/Users/me/Downloads/SpritesFront"): error=2, No such file or directory
      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
      at Downloader.uncompressImage(Downloader.java:32)
      at Main.main(Main.java:51)
  Caused by: java.io.IOException: error=2, No such file or directory
      at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
      at java.base/java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:319)
      at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:250)
      at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
      ... 3 more
  </code></pre>
  
  <p>This is the code that I am using to run the command:</p>
  
  <pre><code>public void uncompressImage (String name, boolean back, String path) {
  
          String b = "";  
  
          if (back) {
  
              b = "-back";
  
          }
  
          ProcessBuilder pb = new ProcessBuilder();
  
          String[] args = new String[] {"convert" , name + b + ".gif", "-coalesce", name + b + ".gif"};
  
          try {
              pb.directory(new File(path));
              pb.command(args);
              Process process = pb.start();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
      }
  </code></pre>
  
  <p>And this is where I am calling the method:</p>
  
  <pre><code>for (String element : allNames) {
  
      myDownloader.uncompressImage(element, false, "/Users/me/Downloads/SpritesFront");
  
  }
  </code></pre>
  
  <p>And <code>allNames</code> is an array that holds the names of the files that I am trying to uncompress.</p>
  
  <p>Does anyone know what is causing the error message?</p>
  
  <p>Edit: If anyone was wondering the convert command is an ImageMagick command I have installed in my computer through Homebrew</p>