This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Does anyone know of an easy way to obtain basic system information via Java? I'm talking about things like amount of RAM, total and available disk space, processor type/speed, etc. Stuff that would be used in conjunction with bug reports.
I've basically been tasked with trying to include that info with our app's automated error reports, but it's one of those "only do it if it takes less than an hour" kinda things... so no JNI or anything like that. I'm looking through the API docs (e.g. at classes like System), but nothing's jumping out.
Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>
Be aware though that the memory referred to in those Runtime methods is the memory used by the JVM process. It's not the total memory available on the machine. I don't know of a way to get that in Java, other than to use either System.exec() or JNI to access some platform-specific code. As for the stuff you want on the filesystem - that's hard to get in Java too, unless you're willing to use the Java SE 6 beta, where they've finally added several useful new methods to java.io.File, including getTotalSpace().