| 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.
|
 |
 |
|
|
subject: File Becomes Locked so App Cannot Make Changes to it
|
|
|