自己写了个方法,希望对你有帮助:
package test;
import java.io.*;//windows XP下获取网卡MAC地址的方法
public class MacAddress
{
public static String getMacAddress()
{
String address = null;
Runtime runtime = Runtime.getRuntime();
Process process = null; try
{
process = runtime.exec("ipconfig /all");
InputStream in = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in) );
String tmp = null;
while( (tmp = reader.readLine()) != null )
{
if(tmp.indexOf("Physical Address")!=-1)
{
address = tmp.split(":")[1];
break;
}
}
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
return address;
}
}
package test;
import java.io.*;//windows XP下获取网卡MAC地址的方法
public class MacAddress
{
public static String getMacAddress()
{
String address = null;
Runtime runtime = Runtime.getRuntime();
Process process = null; try
{
process = runtime.exec("ipconfig /all");
InputStream in = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in) );
String tmp = null;
while( (tmp = reader.readLine()) != null )
{
if(tmp.indexOf("Physical Address")!=-1)
{
address = tmp.split(":")[1];
break;
}
}
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
return address;
}
}
解决方案 »
- java连接数据库mysql时候出现错误求解决
- Spring MVC 中 怎样从一个Controller 方法跳转到另一个方法,注意是跳转,不是调用
- 表示图中坐标轴上阴影部分的正确表达式是?
- 保存到oracle中的乱码如何恢复?
- 网页播放视频为什么一直处在缓冲状态?
- 学习struts、spring、hibernate有啥好书推荐吗?
- 急阿...请各位解决一下spring与xfire的问题(org.codehaus.xfire.fault.XFireFault: There must be a method name element.)
- 在线急等!谢谢!如何使用httpservletrequestwrapper
- 在struts中,返回错误信息,出现乱码。(分数虽少,谢谢帮助)
- 急: 功能(feature)冲突在WEB SERVICE 中的例子
- 学web services很迷茫,不知道将来能怎么运用啊!!!
- 利用实体bean能不能实现数据的并发控制呀
http://dev.csdn.net/article/82277.shtm
自己看看吧