public static void getLisence(){
System.out.println(System.getProperty("os.name"));
try {
Process process = Runtime.getRuntime().exec("ipconfig /all");
BufferedReader bufferReader = new BufferedReader (new InputStreamReader(process.getInputStream()));
int index=0;
String line="";
while((line = bufferReader.readLine())!=null){
index = line.indexOf("Physical Address");
if(index>=0){
index = line.indexOf(":");
if(index>=0){
line = line.substring((index+1)).trim();
break;
}
}
}
System.out.println(line);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Java 获取Mac地址 MD5后 可用于licence
最新推荐文章于 2024-05-10 15:10:22 发布
本文介绍了一个Java方法用于获取当前操作系统的名称,并通过执行ipconfig/all命令来读取MAC地址的过程。此方法适用于Windows环境,展示了如何利用Java运行时执行系统命令并解析输出以获取特定信息。
800

被折叠的 条评论
为什么被折叠?



