aspose file tools*
The moose likes Java in General and the fly likes File Becomes Locked so App Cannot Make Changes to it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "File Becomes Locked so App Cannot Make Changes to it" Watch "File Becomes Locked so App Cannot Make Changes to it" New topic
Author

File Becomes Locked so App Cannot Make Changes to it

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1446
    
    1
When I run the following the file becomes Locked and the App cannot manipulate it.
How can I release the file after the properties are retreived?

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

Always close all your resources*. Use a finally block for this; don't be afraid to nest try statements:
* like InputStreams, OutputStreams, Readers, Writers, SQL connections, SQL statements, SQL result sets, etc.

You may see the following, but I think it's a lot nastier:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1446
    
    1
Rob Prime wrote:Always close all your resources*. Use a finally block for this; don't be afraid to nest try statements:


Thanks, this is exactly what I needed.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Becomes Locked so App Cannot Make Changes to it