title: Java check if file.exists() does not work with ImageIO.read(file)
body: <p>
  I know how to check for existence of file via if/else, and it worked in my previous assignment:</p>
  
  <pre class="lang-java prettyprint-override"><code>File f = new File("file.txt");
      if (f.exists() &amp;&amp; f.canRead()) {
          // Code goes here.
      } else { } // Error message.
  </code></pre>
  
  <p>However, if I do the same with buffered image, like so:</p>
  
  <pre class="lang-java prettyprint-override"><code>private BufferedImage img;
  
  File f = new File("pic.png");
      if (f.exists() &amp;&amp; f.canRead()) {
          img = ImageIO.read(f);
      } else { } // Error message.
  </code></pre>
  
  <p>Then compilers demands try/catch or @throws which defeats the purpose. What am I doing wrong? Would it be better to package all my sprites in a .jar and call them as resources (which I am planning on doing once finished)?</p>
  
  <p>If it at all matters, I am running on JRE 1.6, and the file check is inside switch case statement.</p>