aspose file tools*
The moose likes Java in General and the fly likes Retrieving the system information Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Retrieving the system information" Watch "Retrieving the system information" New topic
Author

Retrieving the system information

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Dear all,

I need to get the following information, from my java program

os version
processor
processor count
RAM
Graphic Card
Hard Drive (C: total space and free space, D: total space and free space etc)
Motherboard (name, version)
Antivirus: (Antivirus name and update status)


And please note, this is not about getting information about JVM (For an example, Runtime class has a method to get the RAM, but it actually returns the RAM used by the JVM). This is about getting information about the original OS. Thank you.


Are you better than me? Then please show me my mistakes..
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11497
    
  16

Yohan Weerasinghe wrote:I need to get the following information, from my java program

os version
processor
processor count
RAM
Graphic Card
Hard Drive (C: total space and free space, D: total space and free space etc)
Motherboard (name, version)
Antivirus: (Antivirus name and update status)

This seems a little odd...I mean, my Unix servers don't have a graphics card.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

There isn't necessarily one way which can be used to get all of those things. So take the list one entry at a time.

It's just like programming really. If you say "I have to do A and B" then the answer is "Do A and then do B". Break the problem down into smaller pieces.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 905
    
    5
Yohan Weerasinghe wrote:
Hard Drive (C: total space and free space, D: total space and free space etc)


Strange. Some system have only one drive or at least three.

Others do not have C: or D: but unspeakable horrors like
/usr
/var
/boot
/home
/tmp
or even a simple "/"
Anyway: Java strives for platform independency Such system-dependent things are therefore problematic.
Newer Java versions support however "java.nio.file.FileSystem.getRootDirectories".
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Ivan Jozsef Balazs wrote:Newer Java versions support however "java.nio.file.FileSystem.getRootDirectories".


And older versions have File#listRoots().


luck, db
There are no new questions, but there may be new answers.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

here is some more clarification. C,D etc means hard drives. I knw the name changes in linux and others. No prob, but the required details are needed. If it has graphic card, it should get the required details. At least can i know whether these tasks are possible? Then i can break them and ask one by one as i go with the project
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

So if one of them isn't possible, you're going to scrap the whole idea?
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Of course not. This software is for a QA forum. I am not gonna let them down.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

That's what I thought. So start with the first one and work your way down the list. Trying to solve them all at once is going to get confusing.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Paul Clapham wrote:That's what I thought. So start with the first one and work your way down the list. Trying to solve them all at once is going to get confusing.


yeah, sure :)
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 905
    
    5
Yohan Weerasinghe wrote:
os version


It is revealed in one of the System properties:
System Properties (The Java Tutorials)

"os.arch" Operating system architecture
"os.name" Operating system name
"os.version" Operating system version

The system architecture might give a clue on the processor family.
 
 
subject: Retrieving the system information