Topic: 如何用JAVA语言获取服务器的基本信息呢

  Print this page

1.如何用JAVA语言获取服务器的基本信息呢 Copy to clipboard
Posted by: realnicky
Posted on: 2005-09-05 10:39

譬如说硬盘的ID,网卡的MAC地址等?

2.Re:如何用JAVA语言获取服务器的基本信息呢 [Re: realnicky] Copy to clipboard
Posted by: javadd
Posted on: 2005-09-05 13:05

调用cmd

3.Re:如何用JAVA语言获取服务器的基本信息呢 [Re: realnicky] Copy to clipboard
Posted by: realnicky
Posted on: 2005-09-05 13:27

能说的具体点吗?

4.Re:如何用JAVA语言获取服务器的基本信息呢 [Re: realnicky] Copy to clipboard
Posted by: YuLimin
Posted on: 2005-09-05 23:57

可以参考这里:
http://www.cjsdn.net/post/view?bid=29&id=70519&sty=3&keywords=CPU

如果只是要看虚拟机的内存使用情况可以用
long tr = r.totalMemory();
//Returns the total amount of memory in the Java Virtual Machine.

long fr = r.freeMemory();
//Returns the amount of free memory in the system.

程序如下:
public class ShowMemory
{

public static void main(String[] args)
{
java.lang.Runtime r =java.lang.Runtime.getRuntime();
long tr = r.totalMemory();
long fr = r.freeMemory();
System.out.println("total:"+tr );
System.out.println("free :"+fr );
}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923