How to get the processor name and registered to informations using java?
How we can get the processor name开发者_C百科 and registered to informations from PC? How is it possible through Java? I'm using windows OS.
Refer this image.
How its possible through java?
Generally, this is not possible to do in Java. You would have to go through an external program (see ProcessBuilder
) or through a native library (written in for instance C++).
You could do
System.getProperty("os.arch");
to get the OS architecture though. This gives "amd64"
on my machine.
The page here lists a few other system properties too, but these seem to be VM specific though:
sun.cpu.endian=little
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
There is a library called Sigar out there that can do all those fancy things.
The sigar jar can be called 'standalone' to explore the system:
$ java -jar sigar.jar
sigar> free
total used free
Mem: 8388608 7940428 448180
-/+ buffers/cache: 5872060 2516548
Swap: 262144 95296 166848
RAM: 8192MB
For this to work, you also need the respective .dll or .so in the classpath
In RHQ-project we use Sigar for many of those statistics - you can browse the code here.
精彩评论