This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes File existing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "File existing" Watch "File existing" New topic
Author

File existing

mike cool
Greenhorn

Joined: Oct 21, 2005
Posts: 24
hi
i created a method that will create a file in spacific path ..
no i close the app and reopen it , now i want check if the file exists or not , i know there is a method in File class exists()-boolean but this method will not allow me to choose the path ?? coz i think it will check in the project path not the path that i creat the file to ....??
Sri Ram
Ranch Hand

Joined: Oct 03, 2005
Posts: 118
Hi
The API for File says,

File(String pathname) Creates a new File instance by converting the given pathname string into an abstract pathname.


And for the method exist says
Tests whether the file or directory denoted by this abstract pathname exists.


U can use File.exist() to check if the file exist without any problem.
Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
If you would like, here's a little code segment for yer' ...
 
wood burning stoves
 
subject: File existing
 
Similar Threads
How to check whether a class exist dynamically?
FTP Server Search
Listener
Accessing files, detemining if they exist...
help JFileChooser--about overwrite file