Get MAC Address of Localhost in Java


This example shows how to find the MAC Address or Hardware Address of localhost or local system using Java NetworkInterface class getHardwareAddress() method.

Since JDK 1.6, Java developers are able to access network card detail via NetworkInterface class. In this example, we show you how to get the localhost MAC address in Java.


Current IP address :
Current MAC address : 00-26-B9-9B-61-BF

Note: The NetworkInterfaceNetworkInterface.getHardwareAddress() method is only allowed to access localhost MAC address, not remote host MAC address.

Share This Post On: