title: Error in Java with file reading
body: <p>So there is the code:</p>
  
  <pre><code>public class Main{
    public static void main(String[] argv) throws IOException{
      new Main().run();
    }
    PrintWriter pw;
    Scanner sc;
    public void run() throws IOException{
      sc = new Scanner(new File("input.txt"));
      int a=sc.nextInt();
      pw = new PrintWriter(new File("output.txt"));
      pw.print(a*a);
      pw.close();
    }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Exception in thread "main" java.io.FileNotFoundException: input.txt (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(Unknown Source)
      at java.util.Scanner.&lt;init&gt;(Unknown Source)
      at Main.run(Main.java:14)
      at Main.main(Main.java:8)
  </code></pre>
  
  <p>Like i understand it can't find file named input.txt, BUT! I have that file in same directory where Main class is, what can be the promblem then?
  p.s Tried on cmd and eclipse, both give same error.</p>