1 2 Previous Next 18 Replies Latest reply on Dec 26, 2007 4:46 PM by 807603

    File fp = new File(filePath);fp.exists() does not yeild proper result

      Below given is the code to check if a file exists.

      I am using "jdk1.5.0_13"

      This code works on Windows but on Linux it fails even when the file exists.
      Please let me know if you have a solution or a work around for this.

      Also ,it is not a slash versus backslash issue.
      I gave the path as /tmp/file.txt on Linux and c:\file.txt on windows.
      On windows i get the correct answer but on linux the
      API returns false even when the file exists.

      boolean DoesTheFileExist(String filePath)
      File fp = new File(filePath);
      if(true == fp.exists())
      return true;
      return false;

        1 2 Previous Next