This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes I/O unhandle Streams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "I/O unhandle Streams" Watch "I/O unhandle Streams" New topic
Author

I/O unhandle Streams

kajal mukergi
Ranch Hand

Joined: Mar 22, 2007
Posts: 102
Hi,

There is problem for deleting file from my temperary folder , i keeping file.exists check and then i try to delete.. file.delete
But 100 time i think only 2 or 3 times it deleted

it gives me false as response every time.

but problem is here , when i searched for this solution every one says.. you have close all the streams.. , and some say System.gc() is good solution , for me really it helped
but i don't want to use

Could any one tell me solution or any tool available for see the streams..not for memory leak. please.

TOOL or plugin for eclipse really helpful now i am using

Regards
KVA
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

System.gc() isn't a good option. It may help, but it doesn't take away the cause of the problem.

Usually you put all your streams in a try-finally block, with optional catch blocks. For instance:
No matter what happens inside the try block, the input stream will be closed.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
kajal mukergi
Ranch Hand

Joined: Mar 22, 2007
Posts: 102
Ok I will do that , out of interest i want to know IS THERE ANY TOOL EXISTING FOR SEEING THE OPEN STREAMS
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

No need to shout; KeepItDown.

On Windows you can use Process Explorer. It can do a lot more, but finding open "handles" is one of its functionalities. On Linux / UNIX you can try lsof. Both will just say that java.exe has the lock though.
kajal mukergi
Ranch Hand

Joined: Mar 22, 2007
Posts: 102
Hi Friend,

Sorry if the above message is interpreted as "Shout" , I only wanted to highlight it.

It is really sad to hear that we don't have any tool yet.. after these many years of JAVA arrival..

Ok Bad but really sad.
 
Consider Paul's rocket mass heater.
 
subject: I/O unhandle Streams
 
Similar Threads
Problem with delete a file
file Deletion
Logging in the Application
Delete file
java.security.AccessControlException