如何用JAVA得到系统信息

softjet 2003-08-21 01:43:10
如何用JAVA得到本机的CPU型号,BIOS信息,硬盘信息以及网卡的MAC地址等信息。
谢谢
...全文
79 46 打赏 收藏 转发到动态 举报
写回复
用AI写文章
46 条回复
切换为时间正序
请发表友善的回复…
发表回复
fefang2003 2004-03-19
  • 打赏
  • 举报
回复
studying
jerrygui 2004-03-10
  • 打赏
  • 举报
回复
使用java.util.Properties;
jimoren 2004-03-07
  • 打赏
  • 举报
回复
同意楼上的.
disciplined 2004-01-23
  • 打赏
  • 举报
回复
上面的代码还是通过调用nbtstat -a命令实现的
java本身是不提供这类要求的支持!
因为底层是c/c++的领域
itblue 2004-01-18
  • 打赏
  • 举报
回复
ddddddddddd
yaray 2003-12-27
  • 打赏
  • 举报
回复
xue xi
guoxyj 2003-12-27
  • 打赏
  • 举报
回复
/**
根据机器的名称或者IP地址得到网卡的MAC地址
*/
import java.io.*;

public class GetMac
{
//通过IP获取网卡地址
private String getMacAddressIP(String remotePcIP){
String str="";
String macAddress="";
try {
Process pp= Runtime.getRuntime().exec ("nbtstat -A " + remotePcIP);
InputStreamReader ir = new InputStreamReader(pp.getInputStream());
LineNumberReader input = new LineNumberReader (ir);
for (int i = 1; i <100; i++)
{
str=input.readLine();
if (str!=null)
{
if(str.indexOf("MAC Address")>1)
{ macAddress=str.substring(str.indexOf("MAC Address")+14,str.length());
break;
}
}
}
}
catch (IOException ex) {}
return macAddress;
}
//通过机器名获取网卡地址
private String getMacAddressName(String remotePcIP){
String str="";
String macAddress="";
try {
Process pp= Runtime.getRuntime().exec ("nbtstat -a " + remotePcIP);
InputStreamReader ir = new InputStreamReader(pp.getInputStream());
LineNumberReader input = new LineNumberReader (ir);
for (int i = 1; i <100; i++)
{
str=input.readLine();
if (str!=null)
{
if(str.indexOf("MAC Address")>1)
{ macAddress=str.substring(str.indexOf("MAC Address")+14,str.length());
break;
}
}
}
}
catch (IOException ex) {}
return macAddress;
}


public static void main(String[] args)
{
GetMac getmac;
getmac=new GetMac();
String mac="";
mac=getmac.getMacAddressIP("10.67.0.6");
System.out.println(mac);
mac=getmac.getMacAddressName("gxy ");
System.out.println(mac);
}
}


chashui 2003-12-27
  • 打赏
  • 举报
回复
up
softjet 2003-12-26
  • 打赏
  • 举报
回复
up
softjet 2003-11-29
  • 打赏
  • 举报
回复
up
junyi2003 2003-11-04
  • 打赏
  • 举报
回复
用PHP一句话搞定,哈哈
softjet 2003-11-04
  • 打赏
  • 举报
回复
up
softjet 2003-10-25
  • 打赏
  • 举报
回复
up
softjet 2003-10-14
  • 打赏
  • 举报
回复
up
lywhu 2003-10-14
  • 打赏
  • 举报
回复
zcjl朋友的结果好像是JAVA虚拟机的系统信息
caoxmby 2003-09-20
  • 打赏
  • 举报
回复
值得关注
sohu98 2003-09-20
  • 打赏
  • 举报
回复
up
CgPanda_ 2003-09-20
  • 打赏
  • 举报
回复
█████████
█┏━━━━━┓█
█★ ★█
█ ☆ ☆ █
█ █
█ 〖初窥Java〗 █
█ 【虚心学习】 █
█★ ★█
█┗━━━━━┛█
█████████
kkbora 2003-09-20
  • 打赏
  • 举报
回复
zd1233 2003-09-18
  • 打赏
  • 举报
回复
up
加载更多回复(26)

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧