title: Running shell script(containing wget) from Java
body: <p>I'm trying to execute a shell script from Java.The script is supposed to download the file from the URL using wget.Here goes my code.</p>
  
  <pre><code>     public class RunShellScriptFromJava {
           public static void main(String a[]) {
           try {
                ProcessBuilder pb = new ProcessBuilder("/bin/sh","script.sh");
                Process p = pb.start();
                p.waitFor();
                System.out.println("Success");
           } catch (Exception e) {
           e.printStackTrace();
        }
       }
      }
  </code></pre>
  
  <p>Content of script.sh</p>
  
  <pre><code>     echo "start"
       wget http://alex.smola.org/drafts/thebook.pdf
       echo "end"
  </code></pre>
  
  <p>My Question:
  Is this the right way doing it?If not please point me in the right direction.It doesn't throw any exception but I see that the file is not getting downloaded.Any lead/help is appreciated.</p>
  
  <p>Thanks.</p>
  
  <p>PS:I have given execute permission for the script</p>