Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileNotFoundException - Access is denied

 
kamilla miesak
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I keep getting FileNotFoundException - Access is denied - when i'm trying to create and print to a file located in user's current working directory.
The same code works fine if I explicitly specify already existing folder i.e. c:\temp\test.txt (the new file gets created and contents are added to it). What might me causing the problem?
Thanks in advance for all the ideas!
Kamilla
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what's going on. How exactly are you attempting to create the new file? I suggest something like the following:

The getAbsolutePath() is useful because often people turn out to not be in the directory they think they are (depending on how they invoked the java command).
[ July 15, 2002: Message edited by: Jim Yingst ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic