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 p
You can use the following Java code to query the physical memory:
com.sun.management.OperatingSystemMXBean os = (com.sun.management.OperatingSystemMXBean)
java.lang.management.ManagementFactory.getOperatingSystemMXBean();
long physicalMemorySize = os.getTotalPhysicalMemorySize();
But the package com.sun.management
is optional and need not be available on every platform.