title: Java file input as command line argument
body: <p>How do you process information in Java that was input from a file.  For Example: suppose you have a file input.txt.  The contents of this file is: 
  abcdefghizzzzjklmnop 
  azzbcdefghijklmnop</p>
  
  <p>My hope would be that the information would be put into the argument array of strings such that the following code would output "abcdefghizzzzjklmnop"</p>
  
  <pre><code>class Test {
      public static void main(String[] args) {
          System.out.println(args[0]);
      }
  }
  </code></pre>
  
  <p>The command I have been using throws an array out of bound exception.  This command is:</p>
  
  <blockquote>
    <blockquote>
      <p>java Test &lt; input.txt</p>
    </blockquote>
  </blockquote>
  
  <p>Non-file based arguments work fine though. ie. java Test hello,a nd java Test &lt; input.txt hello. </p>
  
  <p>More information:
  I have tried putting the file contents all on one line to see if \n \r characters may be messing things up. That didn't seem to help.  </p>
  
  <p>Also, I can't use the bufferedreader class for this because this is for a program for school, and it has to work with my professors shell script.  He went over this during class, but I didn't write it down (or I can't find it).</p>
  
  <p>Any help?</p>