国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

Java獲取mac地址的方法

2019-11-26 15:04:10
字體:
來源:轉載
供稿:網(wǎng)友

本文實例講述了Java獲取mac地址的方法。分享給大家供大家參考。具體如下:

/** GetMacAddress .java** description:get Mac addreess** @author hadeslee** Created on 2007-9-27, 9:11:15** To change this template, choose Tools | Templates* and open the template in the editor.*/package test2; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /****/public class GetMacAddress {public static String getMACAddress() {String address = ""; String os = System.getProperty("os.name"); System.out.println(os); if (os != null && os.startsWith("Windows")) {try {ProcessBuilder pb = new ProcessBuilder("ipconfig", "/all"); Process p = pb.start(); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ((line = br.readLine()) != null) {if (line.indexOf("Physical Address") != -1) {int index = line.indexOf(":"); address = line.substring(index+1); break; }}br.close(); return address.trim(); } catch (IOException e) {}}return address; }public static void main(String[] args) {System.out.println("" + Test.getMACAddress()); }}

希望本文所述對大家的java程序設計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 大埔区| 都昌县| 墨竹工卡县| 靖州| 大庆市| 博湖县| 明光市| 班玛县| 宁陕县| 岑巩县| 永福县| 桂平市| 青阳县| 清苑县| 宜城市| 蒙山县| 绍兴县| 饶平县| 渭南市| 张家川| 长葛市| 远安县| 西华县| 阿勒泰市| 德庆县| 游戏| 华宁县| 古交市| 建水县| 晋城| 大新县| 孟村| 梧州市| 莱芜市| 洛浦县| 奉贤区| 扬州市| 罗源县| 南岸区| 杭州市| 肃宁县|