title: How to give input to System.in via a .in file in Netbeans
body: <p>I have a very large input set that I want to give to a small Java program I'm trying to debug, but I'm lost on how to accomplish this. My program reads in data via a Scanner reading System.in</p>
  
  <p>giving the command line argument in Run under Project Properties does not seem to work. I give it "&lt; testfile.in" and it interprets it as two values in args[]. I need it to interpret this as reading the file as System.in</p>
  
  <p>edit: my code</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner ifp = new Scanner(System.in);
      int numCities = ifp.nextInt();
      for(int c=0; c&lt;numCities; c++){
          int intersections = ifp.nextInt();
          int streets = ifp.nextInt();
  
          destination = intersections-1;
          ArrayList&lt;Edge&gt; edges = new ArrayList&lt;&gt;();
          ArrayList&lt;Edge&gt; negEdges =  new ArrayList&lt;&gt;();
          for(int i=0; i&lt;streets; i++){
              int start = ifp.nextInt();
              int end = ifp.nextInt();
              int distance = ifp.nextInt();
              Edge temp = new Edge(start, end, distance);
              edges.add(temp);
              temp = new Edge(start, end, -distance);
              negEdges.add(temp);
          }
  
          /* some shenanigans where I don't scan in anything */
      }
  }
  </code></pre>