con el siguiente método podrás obtener la MAC de la máquina.
Código:
Código: Seleccionar todo
public static String getMacAddress() {
String r = "";
try {
InetAddress address = InetAddress.getLocalHost();
NetworkInterface ni = NetworkInterface.getByInetAddress(address);
byte[] mac = ni.getHardwareAddress();
for (int i = 0; i < mac.length; i++) {
r += String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "");
}
} catch (Exception ex) {
System.out.println("ERROR: "+ex.getLocalizedMessage());
}
return r;
}
Código: Seleccionar todo
System.out.println("Mi dirección MAC es: "+getMacAddress());