MAC (Media Access Control)Addreess, Network Card address.

Hi ,Could you please tell me how to read computer's MAC Address using Java programme.its urgent ! Thanks ramesh
[174 byte] By [rameswar] at [2007-9-26 3:09:26]
# 1

You can get the mac address by running ipconfig in a DOS prompt and parsing out the data.

//First run ipconfig

Process conf = Runtime.getRuntime().exec("c:/windows/ipconfig.exe /all");

// then parse out the response

DataInputStream ds = new DataInputStream(conf.getInputStream());

while ((String lineItem = ds.readLine()) != null) {

// look for index of "Physical Address" and you have it

}

There is a lot more information returned here as well you might find usefull.

dpagan at 2007-6-29 11:15:11 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2

> You can get the mac address by running ipconfig in a

> DOS prompt and parsing out the data.

>

> //First run ipconfig

> Process conf =

> Runtime.getRuntime().exec("c:/windows/ipconfig.exe

> /all");

>

> // then parse out the response

> DataInputStream ds = new

> DataInputStream(conf.getInputStream());

> while ((String lineItem = ds.readLine()) != null) {

> // look for index of "Physical Address" and you have

> e it

> }

>

> There is a lot more information returned here as well

> you might find usefull.

This solution seems platform specific. Do you have a solution that is more portable?

jcurrie191 at 2007-6-29 11:15:11 > top of Java-index,Security,Other Security APIs, Tools, and Issues...