Results 1 to 3 of 3
- 12-26-2007, 03:25 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 1
- Rep Power
- 0
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);
return fp.exists();
}
Regards,
GaneshLast edited by ganeshp; 12-26-2007 at 03:43 PM.
- 12-26-2007, 11:42 PM #2
Your segment of code appears correct. Do you have the correct permissions on Linux to decipher whether you have the file or not? Please post your currently functioning code because having others run and test your code will bring your question to a swifter resolution. And remember to use code tags.
- 04-07-2009, 06:25 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
count character in text file as input file
By aNNuur in forum New To JavaReplies: 7Last Post: 03-25-2010, 04:01 PM -
How to check whether file is exists or not
By Java Tip in forum java.ioReplies: 0Last Post: 04-05-2008, 10:13 AM -
How to read a text file from a Java Archive File
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:13 AM -
Simply output the result to a text file.
By silvia in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:48 AM -
Regarding conversion of Image file to Video file
By RamaDeviMsc in forum Advanced JavaReplies: 0Last Post: 06-25-2007, 02:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks