title: Java - I want to read a file name from command line then use a bufferedreader to read each line
body: <p>I'm getting an eclipse red underline error on the </p>
  
  <pre><code> br = new BufferedReader(new FileReader(inFile));
  </code></pre>
  
  <p>line on "inFile".  This is the object that I would like to read which I believe contains the command line filename/path that I give it on the command line.  Am I handling this wrong?</p>
  
  <pre><code>import java.io.File;
  import java.io.BufferedReader;
  import java.io.FileReader;
  import java.io.IOException;
  
  public class Main {
  
       public static void main(String[] args) {
        if (0 &lt; args.length) {
            File inFile = new File(args[0]);
        }
  
          BufferedReader br = null;
  
          try {
  
              String sCurrentLine;
  
              br = new BufferedReader(new FileReader(inFile));
  
              while ((sCurrentLine = br.readLine()) != null) {
                  System.out.println(sCurrentLine);
              }
  
          } 
  
          catch (IOException e) {
              e.printStackTrace();
          } 
  
          finally {
              try {
                  if (br != null)br.close();
              } catch (IOException ex) {
                  ex.printStackTrace();
              }
          }
      }
  }
  </code></pre>