aspose file tools*
The moose likes Beginning Java and the fly likes Obtaining system information (RAM, disk space, etc) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Obtaining system information (RAM, disk space, etc)" Watch "Obtaining system information (RAM, disk space, etc)" New topic
Author

Obtaining system information (RAM, disk space, etc)

dave taubler
Ranch Hand

Joined: May 15, 2001
Posts: 132
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.

Thanks!


Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>
John Weir
Greenhorn

Joined: Nov 20, 2004
Posts: 6
Learn by example.
Hi here is a solution for you'r problem.

But please be sure to visit:

http://java.sun.com/docs/books/tutorial/essential/system/properties.html



dave taubler
Ranch Hand

Joined: May 15, 2001
Posts: 132
Ah, I keep forgetting about Runtime.

Thanks!
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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().


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Obtaining system information (RAM, disk space, etc)