File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes file names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "file names" Watch "file names" New topic

file names

chris x barrett

Joined: Dec 20, 2005
Posts: 10
i want to check and see if there is a file with a certian name and i don't know how ...i don't want to read from the file just want to know the name of the file.
Stephen Foy
Ranch Hand

Joined: Oct 17, 2005
Posts: 143
you could try

Stephen Foy - Microsoft Application Development Consultant
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

You could do that, although since throwing an exception is expensive, this is very inefficient (and as written, it leaves the FileReader open... not good!) But it would be much better to use the method:

[Jess in Action][AskingGoodQuestions]
chris barr
Ranch Hand

Joined: Apr 20, 2006
Posts: 37
Thanks that helped alot.
subject: file names
It's not a secret anymore!