title: Can't run rar.exe through Process
body: <p>I'm trying to unpack a rar file from my Java application. </p>
  
  <p>I've found plenty of solutions on how to execute a command which works for stuff like <code>dir</code> etc on Windows. But it doesn't seem to work for any other application like <code>gcc</code> or <code>rar</code>. I know they both work because when I execute them in <code>cmd</code> they give me proper output.</p>
  
  <p>However, I'd like to print the output they spit out in the <code>cmd</code>. I just don't really get why it works for <code>dir</code> and for nothing else (none "native" commands).</p>
  
  <p>The <code>exitVal</code> always seems to be 0..</p>
  
  <pre><code>    try {
          Runtime rt = Runtime.getRuntime();
  
          Process pr = rt.exec("cmd /c rar.exe"); //Does not work
  
          //Process pr = rt.exec("cmd /c dir") // This works
          //Process pr = rt.exec("gcc.exe");
  
          BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  
          String line=null;
  
          while((line=input.readLine()) != null) {
              System.out.println(line);
          }
  
          int exitVal = pr.waitFor();
          System.out.println("Exited with error code "+exitVal);
      }catch(IOException e)
      {
          System.out.println("An error occured. Are you sure the executable is in your Windows PATH?");
      }
      catch(Exception e) {
          System.out.println(e.me);
          e.printStackTrace();
      }
       catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
      }
  </code></pre>