Friday, June 1, 2001 03:17 AM
It would be nice :) in this way we could be able to get hardware information about any platform... But... as hardare is platform dependent, Java isn't the best choice for your application. If you want to do it in Java, you should use JNI and link your code with native C procedures.
Anyway, for cpu type, memory storage should be not a problem... for network/graphic adapter it could be.
Try this code:
Properties p = System.getProperties();
System.out.println("OS: " + p.getProperty("os.name") + " "
Runtime runtime = Runtime.getRuntime();
System.out.println("Total Memory: " + runtime.totalMemory());
System.out.println("Free Memory: " + runtime.freeMemory());
this works with JDK 1.3 by Sun and prints:
CPU: pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386
OS: Windows NT 4.0
Total Memory: 2031616
Free Memory: 1859192