title: java.io.IOException: Cannot run program error=2, No such file or directory
body: <p>I have a java class in which I call a runshellscript method that will execute a script. It worked well with mysql but I cannot seem to find out why it wont work well with psql. Here is an excerpt of my runshell method:</p>
  
  <pre><code>public class RunShellScript {
  
  public static void runShellScript (String unixCommand) 
  {
   try {
       Runtime runtime=Runtime.getRuntime();
       //Process process=runtime.exec(new String [] { "/bin/csh", "-c", unixCommand});
       Process process=runtime.exec(new String [] {unixCommand});
       InputStream stderr=process.getErrorStream();
       InputStreamReader isr=new InputStreamReader (stderr);
       BufferedReader br=new BufferedReader (isr);
       String line=null;
       System.out.println("&lt;ERROR&gt;");
  
       while((line=br.readLine())!=null)
           System.out.println(line);
  
       System.out.println(line);
       int exitVal=process.waitFor();
       System.out.println("Process exitValue:" + exitVal);
   }
   catch (Throwable t)
   {
       t.printStackTrace();
   }
  </code></pre>
  
  <p>the problem is that when i put this behind a mouse clicked event it says command not found. Here is the code beuind the mous event</p>
  
  <pre><code>private void jMenuItem13MousePressed(java.awt.event.MouseEvent evt)    {                                         
  
      String shellCommand="vobs/tools/Scripts/DataValidation/mysqlconnection.csh";
      RunShellScript.runShellScript(shellCommand);
      // TODO add your handling code here:
  }                     
  </code></pre>
  
  <p>The weird thing is that when I go directly to the directory where the script resides and type ./mysqlconnection the script works. But when i just type mysqlconnection is says command not found. Somehow it is not recognizing my script name as a command?</p>