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 Java 8 in Action this week in the Java 8 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

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.


Dave Taubler<br />Specializing in <a href="" target="_blank" rel="nofollow">Java and Web Development</a>
John Weir

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

But please be sure to visit:

dave taubler
Ranch Hand

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

Jim Yingst

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, including getTotalSpace().

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Obtaining system information (RAM, disk space, etc)
Similar Threads
accessing system info
What Should I Download To Use the Oracle 9i?
Versions of Linux. Slackware vs Red Hat vs ?
Problem while booting Win XP