This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File Won't Delete  RSS feed

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Java 7 with the new NIO classes and my file will not delete after being sent using the mail api.
Here is some code:

 
Paul Clapham
Sheriff
Posts: 22504
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're assuming that this transport thing has something to do with the problem. I'm not convinced (especially if it's JavaMail). Presumably you have code elsewhere which mentions the file, so let's have a look at that code.
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the error message say anything? That would be useful. It's also good practice to not just use e.getMessage(), but rather e.toString() - especially if you don't know what kind of exception you're getting. The difference is that toString() gives you both the message and the name of the exception. This name is sometimes useful extra info. Sometimes your message may even be null, but the exception name tells you something useful.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike you are so right. The message says that the request cannot be executed because the file is being used by another process. I did switch from e.getMessage() to e.toString(), and in this case it is the same message. It is a FileSystem Exception
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!