How to read a MAC address of the host from a JAVA program

Discussions

General J2EE: How to read a MAC address of the host from a JAVA program

  1. How to read a MAC address of the host from a JAVA program
    Thanks
    Purushotham
  2. I don't think it's possible in a pure java solution. Products like FlexLM do it as part of their functionality, but they delagate the actual reading of the MAC address to a native app. Then the problem is that retrieving the MAC address is very different on different platforms, so the native app is rewritten for each platform, and distributed with the client.

    That's my understanding anyway.
  3. Thanks for the reply. I totally agree with you. I was designing a licensing manager for a wireless product for solaris and for NT. Can you/anyone please point out the native methods to get the MAC of a NT machine as well as MAC for Solaris.
    Thanks
  4. Methods show below[ Go to top ]

    for windows NT: ipconfig/all for Linux: ifconfig for more detail: http://www.artsci.wustl.edu/ASCC/documentation/macaddrss.html
  5. JDK 1.6 solution[ Go to top ]

    JDK 1.6 has an API NetworkInterface.getHardwareAddress()