title: How do I find the physical memory size in Java?
body: <p>I'm writing an installer that will tune the configuration of the product for the particular hardware on which it will be run.  In particular, I want to determine how much physical RAM is installed in the system so I can estimate how much memory to allocate to the product when it runs.</p>
  
  <p>Ideally, I'd like to do this in a platform-independent, pure Java way, as the installer will need to run on several different platforms, but in case this isn't possible, solutions for Windows are preferred as that's the most common deployment platform.</p>
  
  <p>In this case, it's safe to assume that the product will be the only/main application running on the box, so I don't have to worry about squeezing anyone else out.  I don't want to over-allocate as this, in our experience, can hurt performance.</p>