Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System information

 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to get java to display the system information of the computer you are currently on?

For example I want to know how big the RAM and Hard Drive are.

But I have no clue how to do it.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no built-in way to do it. Your choices are to use native methods (JNI), or execute an OS-dependent external program to return the values.
 
Atrus Greyor
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK do you know if I can find a good online tutorial for JNI?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go right to the source: http://java.sun.com/docs/books/tutorial/native1.1/index.html .

Now, it seems to me that I recall a third-party open-source library, implemented for all your popular platforms, that did this sort of thing being already available. I can't recall what it's name was, however. Maybe someone else can?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic