我想这个代码来获得一个Linux系统的MAC地址的获取MAC地址:爪哇 - Linux系统
try {
ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
byte[] mac = network.getHardwareAddress();
// System.out.print("Current MAC address: ");
for (int i = 0; i < mac.length; i++) {
is = is + Integer.parseInt(
String.format("%02X%s", mac[i], (i < mac.length - 1) ? "" : ""),16);
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (SocketException e) {
e.printStackTrace();
}
,但它只是崩溃......没有人知道为什么吗?
当它崩溃时,你会得到什么错误信息? –
http://pastebin.com/891wKcXz是的,我已检查过它是这部分。如果我只是把= is + Integer.parseInt([mac address here],16);代码工作正常 – y0u
哪一行是133行? –