Maybe you could arrange the execution of the ipconfig dos command and capture its output? When you use "ipconfig /all" it provides the NIC address. When you use "ipconfig /all >x.txt" it puts the output into x.txt which you could read with your java program. Maybe someone else has some idea on how to run a dos program from java???
The nice thing about Standards is that there are so many to choose from!
@see java.net.NetworkInterface Why are some developers so intent on running a system command to achieve something ? *especially* when the core API provides the desired behaviour. *shakes head in disbelief*
Not sure whether to hang my head in shame or not, but I do not see any thing about NIC addresses in that class, only IP details. But I am certainly not an expert in that area. My impression is that java isolates you from all that low level stuff.
Well, here's some code showing you how to get the NIC cards and some of their info, BUT, I couldn't find out how to get the NIC Cards' physical addresses.
How do I get the physical address? For example, an address like: 00-EE-AA-BB-00-00 (I made it up, but you get the idea). I don't see any place where I can obtain that. [ February 26, 2004: Message edited by: Robert Paris ]
Joined: Jul 28, 2002
I've got some code that works on Windows, OS X and Linux, but they're all just parsing "ifconfig" from Runtime.exec(). Is there really no other way to do this? I have written C code on Windows to grab the Mac Address, but MS helpfully made those APIs different on almost every Windows version (i.e. what works on 98 won't on 2000, etc). Further, I'm not sure that Linux or Unix or OS X have system APIs available for that - I think the only way to get a NIC's address on those OS's is from ifconfig. Is this really true? Is there no other way? Why is it so "ugly" to get that info in Java (or any language apparently)? Does anyone have code for getting MAC address on Unix, Solaris? How would I know it was Unix? (i.e. what would System.getProperty( "os.name" ) return?)
How about a call to the system ARP server? You'll have to use some native code to get to OSI Layer 2 since Java only deals with layers 3 & 4. Tom Blough [ February 26, 2004: Message edited by: Tom Blough ]
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>