class getMac
{
public String getMacByIPConfig()
{
String str = "";
String macAddress = "";
try
{
Process pp = Runtime.getRuntime().exec("ipconfig /all ");
InputStreamReader ir = new InputStreamReader(pp.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
while((str = input.readLine())!=null)
{
if(str.indexOf("Physical Address")!=-1)
{
System.out.println(str);
macAddress = macAddress + ";" + str.substring(str.indexOf(":")+2,str.length());
}
}
}
catch(IOException ex)
{
ex.printStackTrace();
}
return macAddress;
}
}
{
public String getMacByIPConfig()
{
String str = "";
String macAddress = "";
try
{
Process pp = Runtime.getRuntime().exec("ipconfig /all ");
InputStreamReader ir = new InputStreamReader(pp.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
while((str = input.readLine())!=null)
{
if(str.indexOf("Physical Address")!=-1)
{
System.out.println(str);
macAddress = macAddress + ";" + str.substring(str.indexOf(":")+2,str.length());
}
}
}
catch(IOException ex)
{
ex.printStackTrace();
}
return macAddress;
}
}