aspose file tools
The moose likes Servlets and the fly likes How to get the server IP, hostname and MAC? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to get the server IP, hostname and MAC?" Watch "How to get the server IP, hostname and MAC?" New topic
Author

How to get the server IP, hostname and MAC?

Lester Tam
Ranch Hand

Joined: Jun 19, 2003
Posts: 31
As title thanks.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
see API docs.


42
Lester Tam
Ranch Hand

Joined: Jun 19, 2003
Posts: 31
Hello,

i find that i can use this way to get the ip and host name:

hostInfo = InetAddress.getLocalHost();
ip = hostInfo.getHostAddress();
hostName = hostInfo.getHostName();

but still dont know how to get the MAC address.

Any help?
Lester
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you can't get the MAC address. It's not exposed as you have no business using it.
The network is only concerned with ip addresses except at the hardware level which is deeper in the network architecture than what Java is designed to handle.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to get the server IP, hostname and MAC?