Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File Deletion Problem ????  RSS feed

 
Taranjeet Arora
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to delete a file. It is giving Share Violation while manually deleting it even.
The gif file is generated using AWT and I want to delete the same on "Continue" on the same page. I tried using delete() method on File object and have also given the required permissions in weblogic.policy file through grantcode syntax.
Can anyone throw light on this?
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sharing violations usually mean that some other process is accessing the file. If you can't manually delete it, even though you have the proper permissions (which I am assuming), then that means another process needs to close before you can delete it.
You are closing the stream that creates the GIF in the first place, correct?
 
Taranjeet Arora
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the gif file is created using AWT, some reference of the same is created in the weblogic server which does not allow the deletion of the file.
The same is allowed only if I stp the weblogic server.
 
Taranjeet Arora
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jason!!
I was doing the mistake of not closing the FileOutputStream after creating the gif image.
The same is working now after I close the OutputStream.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, and welcome to the Ranch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!