Basically, there is no Java-only API to access hardware information. Maybe in the future, who knows?
The requirement for MAC addresses comes from UUID and a large part from license management. This is really a boring thing. I hope the software will sell services in the future, instead of copying them, saving me the trouble.
I searched for three types of solutions.
1, JDK 6, JDK 7?
See the following link http://bugs.sun.com/bugdatabase/view_bug.do for details? Bug_id = 4691932
2, shell command
Is to intercept the output of commands such as ipconfig and ifconfig, and then parse
There are some open source projects like http://sourceforge.net/projects/javanetcomm/
There are a lot of code snippets like http://forum.java.sun.com/thread.jspa? Threadid = 61556, http://forum.java.sun.com/thread.jspa? Threadid = 245711
The disadvantage of this method is that it may require high system permissions to execute these commands or access the NIC hardware.
3, JNI
There are also open source projects that include this feature, such as http://jug.safehaus.org/
The disadvantage is that deployment is not convenient.
However, not all networks are Ethernet. For License Management, MAC addresses are only a consideration for the concept of "host ID.