tengo el siguiente programa:
Código PHP:
class Mac {
public static void main( String[] args ) throws MalformedURLException, IOException {
InetAddress ip;
try {
//ip = InetAddress.getLocalHost();
ip = InetAddress.getByName("172.16.1.112");
System.out.println("Current IP address : " + ip.getHostAddress());
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
System.out.println(network);
byte[] mac = network.getHardwareAddress();
System.out.print("Current MAC address : ");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
}
System.out.println(sb.toString());
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (SocketException e){
e.printStackTrace();
}
}
}
que no esta en el propio ordenador si no que accedo a ella atraves del navegador,no accede a ella si no que
me da este error Exception in thread "main" java.lang.NullPointerException
y la variable network esta a null.
Gracias
Saludos