title: How to execute perl script from java in ubuntu
body: <p>I have a perl script that needs 2 arguments to be run. I am currently using Ubuntu and I managed to execute the perl script from terminal by changing directory to where the perl script exists and by writing</p>
  
  <pre><code>perl tool.pl config=../mydefault.config file=../Test
  </code></pre>
  
  <p>However, when I am trying to run the perl script from my java program (I am using eclipse), It always gives me the message <code>Command Failure</code>. This is the code :</p>
  
  <pre><code>Process process;
  try {
      process = Runtime.getRuntime().exec("perl /home/Leen/Desktop/Tools/bin/tool.pl config=../mydefault.config file=../Test");
      process.waitFor();
      if(process.exitValue() == 0) {
          System.out.println("Command Successful");
      } else {
          System.out.println("Command Failure");
      }
  } catch(Exception e) {
      System.out.println("Exception: "+ e.toString());
  }
  </code></pre>
  
  <p>So please what is wrong in my code?</p>