title: How to find out number of files currently open by Java application?
body: <p>Suppose a lot of what your application does deals with reading contents of files. It goes without saying that files that are opened then closed and life is good unless ... new files come in faster then old files get closed. This is the pickle of a situation I found myself in.</p>
  
  <p>Now, is there a way to reliably know how many files are opened by the process? Something that is as reliable as looking at <code>ls /proc/my_pid/fd | wc -l</code> from inside the JVM?</p>
  
  <p>I suspect the answer may be OS-specific, so let me add that I am running Java on Linux.</p>