This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The code given below is working for windows but its giving problem in MAC OS In window platform its revaling host address & name if u given address or name of particular comp in network but cudn't revaling the name or ip address of MAC OS on the network,while in MAC OS this code ain't workn at al
java.net.UnknownHostException: datacentre: datacentre at java.net.InetAddress.getAllByName0(InetAddress.java:948) at java.net.InetAddress.getAllByName0(InetAddress.java:918) at java.net.InetAddress.getAllByName(InetAddress.java:912) at java.net.InetAddress.getByName(InetAddress.java:832) at GetInetInfo.main(GetInetInfo.java:12)
cudn't revaling the name or ip address of MAC OS on the network,while in MAC OS this code ain't workn at al
To be honest, it sounds like the Mac isn't on the network. Try using some command line tools to double-check if its visible before worrying about your Java code (e.g. in Windows ping, nslookup, net view etc.)