我想這個代碼來獲得一個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行? –