Over a million developers have joined DZone.

Get Your Machine's MAC Address

DZone's Guide to

Get Your Machine's MAC Address

Free Resource
// Only gets the address for the first net interface, if you have more than one you'll need to get the list
// and decide which you want to use.

    InetAddress add = InetAddress.getLocalHost();
    NetworkInterface ni = NetworkInterface.getByInetAddress( add );
    byte[] mac = ni.getHardwareAddress();

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}