2 Replies Latest reply: Jul 7, 2014 8:26 AM by guizani.seif RSS

    java.io.FileNotFoundException

    guizani.seif

      Hi,

      I have a simple program that checks if my file exists.

       

      I've copied the file under my work folder (with my java classes) and in c:\.

       

      when calling

      new FileInputStream("1.xls")
      
      

      , the code generats an exception error!

       

      Exception in thread "main" java.io.FileNotFoundException: 1.xls (Le fichier spécifié est introuvable)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:146)
        at java.io.FileInputStream.<init>(FileInputStream.java:101)
        at NewMain.main(NewMain.java:25)
      

       

      when calling it with

       

      new FileInputStream("c:\\1.xls")
      

       

      , it works!

       

      Here is my code

       

      public static void main(String[] args) throws FileNotFoundException {
              // TODO code application logic here
              
              InputStream input = new BufferedInputStream(new FileInputStream("c:\\1.xls"));
              
              System.out.print("The file exists");
          }
      

       

      How to fix it plz!

       

      Regards.