I'm getting one java exception when I run my application on linux terminal.
It showing me the exception as "Too many open files . Error : 24".
Its File descriptor error. I dont know how to tackle this issue.
If anybody knows about this error please help me.
Ernest Friedman-Hill wrote:You're probably just leaking file descriptors. Make sure you close every file you open when you're done with it.
And that includes doing the close in a "finally" clause if there's a possibility that an exception would occur that would cause the normal close to be bypassed. I've run into systems that leaked slowly because MOST of the time, execution proceeded normally, but occasional exceptions would leak resources.
Ernest Friedman-Hill wrote:I was reviewing some code the other day by a junior developer that simply didn't close files at all. On questioning, it turned out he figured the garbage collector would do it.
I forgive him (her?). The early docs made such a big thing about how Java collects garbage. And as a pioneer vendor of C++, I'd gotten accustomed to having destructors do exactly that.
However, I got assigned to fix a project that was, in fact, leaking resources (network connections, actually), and now I know better.