title: Run Java program by giving it input using file redirection
body: <p>I'm trying to run a Java program using file redirection. I'm testing it with this simple program:</p>
  
  <pre><code>package netbeans.sanbdox;
  
  public class Sanbdox {
      public static void main(String[] args) {
          for(int i = 0; i &lt; args.length; i++) {
              System.out.println(args[i]);
          }
      }
  }
  </code></pre>
  
  <p>When I go to the command line and run</p>
  
  <pre><code>$ java -jar dist/compiled_project.jar &lt; q1.txt
  $ 
  </code></pre>
  
  <p>There's no output, even though <code>q1.txt</code> is not an empty file. What should I do to make the file redirection work?</p>