• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.nio.file.NoSuchFileException:  RSS feed

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Mycode:


This throws following Exception:

why file is not created?

Best regards
 
Stephan van Hulst
Saloon Keeper
Posts: 7974
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception is not related to the code you've shown us. The exception is thrown when you create a new BufferedWriter in the printReport() method.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here how I am calling newBufferedWriter:

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not passing the option CREATE, so that it will not create the file if it does not yet exist. To create the file if it does not yet exist, add this option:

 
Stephan van Hulst
Saloon Keeper
Posts: 7974
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you carefully read the documentation for newBufferedWriter()? Have you gone through the StandardOpenOptions to see how different options work in conjunction?
 
Farakh khan
Ranch Hand
Posts: 833
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for focusing my attention towards nio API. Superior solution exist in its own API


Problem is fixed. Thanks all
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!