Use CFML and Java get OS info

Playing around with code to see what possible and figured this might be helpful to someone. In short we get CF to access the underlying Java classes to pull out some system level information about memory. Up till now I've been testing on Railo but there is no reason for this not to work with any CFML engine.

Runtime = createObject('java', 'java.lang.Runtime'); File = createObject('java', ''); sysinfo = {}; /* Number of processors or cores available to the JVM */ sysinfo.cores = Runtime.getRuntime().availableProcessors(); /* Total amount of free memory (Mb) available to the JVM */ sysinfo.freemem = fix( Runtime.getRuntime().freeMemory() /1024/1024 ); /* This will return Long.MAX_VALUE if there is no preset limit */ sysinfo.maxMemory = fix( Runtime.getRuntime().maxMemory() /1024/1024 ); /* Total memory (bytes) currently in use by the JVM */ sysinfo.totalMemory = fix( Runtime.getRuntime().totalMemory() /1024/1024 );