title: JAVA + try catch(FileNotFoundException e) going in catch(Exception e)?
body: <p>I have some command which creates a file on disk.
  Because the folder in which the file has to be created is dynamic, I have a catch(FileNotFoundException e). In the same try block, I already have a catch(Exception e) block.
  For some reason, when I run my code and the folder does not exists yet, the catch(Exception e) block is used, not the FileNotFoundException one.</p>
  
  <p>The debugger is clear though (to me at least), showing a FileNotFoundException: java.io.FileNotFoundException: c:\mydata\2F8890C2-13B9-4D65-987D-5F447FF0DDA7\filename.png (The system cannot find the path specified)</p>
  
  <p>Any idea why it doesn't go into the FileNotFoundException block?
  Thanks;</p>
  
  <p>CODE:</p>
  
  <pre><code>import java.io.FileNotFoundException;
  
  try{
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      Rectangle screenRectangle = new Rectangle(screenSize);
      Robot robot = new Robot();
      BufferedImage image = robot.createScreenCapture(screenRectangle);
      ImageIO.write(image, "png", new File(fileName));
  }
  catch (FileNotFoundException e){
      // do stuff here..
      return false;
  }
  catch(Exception e){
      // do stuff here..
      return = false;
  }
  </code></pre>