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
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply 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: 1261
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: 19232

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
How To Ask Questions How To Answer Questions
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1261
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: 19232

You're welcome.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: File Becomes Locked so App Cannot Make Changes to it
 
Similar Threads
Using a Configuration Setting
File Process Fails but Generated No Exception
properties file
Strange File Behavior
Created File cannot be Deleted