• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving the system information

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12100
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Pie
Posts: 20979
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 972
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:Newer Java versions support however "java.nio.file.FileSystem.getRootDirectories".


And older versions have File#listRoots().
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20979
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So if one of them isn't possible, you're going to scrap the whole idea?
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course not. This software is for a QA forum. I am not gonna let them down.
 
Paul Clapham
Sheriff
Pie
Posts: 20979
31
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 972
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic