This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file names

 
chris x barrett
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could try

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 java.io.File.exists() method:

 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that helped alot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic