Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Retrieving the system information

 
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13074
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 27375
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 1043
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 27375
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course not. This software is for a QA forum. I am not gonna let them down.
 
Paul Clapham
Marshal
Posts: 27375
88
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1043
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic