JAVA获取本机的MAC地址】的更多相关文章

/** * 获取本机的Mac地址 * @return */ public String getMac() { InetAddress ia; byte[] mac = null; try { // 获取本地IP对象 ia = InetAddress.getLocalHost(); // 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中. mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress()…
Delphi获取本机的MAC地址: uses   NB30; function GetAdaPterInfo(lana: Char): string; var   Adapter: TAdapterStatus;   NCB: TNCB; begin   FillChar(NCB,Sizeof(NCB),0);   NCB.ncb_command := Char(NCBRESET);   NCB.ncb_lana_num := Lana;   if Netbios(@NCB) <> Char(…
import java.io.File; import java.io.FileWriter; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import com.tjhq.hqoa.utils.Log4jUtil; import com.tjhq.hqoa.utils.StringUtil; //取主板序列号 public class MainBordUt…
写在前面 通常所说查询本机mac地址是以以太网为准的, 也就是网线那个口..这种描述略捞. 但是通过java的getHostAddress获取ip以及getHardwareAddress()方法获取mac时, 需要将网络适配器中多余的连接禁用. 像我笔记本上这种, 打开网络连接发现有好多连接(安装了虚拟机的原因), 此时若不禁用虚拟机的连接即使插上了网线, 执行程序查询出来的还是虚拟机的ip和mac地址. 通过测试有以下结果: 1.连接无线网, 插上网线, 同时启用虚拟机网络连接时, 查询出来的…
http://blog.csdn.net/coolwzjcool/article/details/6698327 版权声明:本文为博主原创文章,未经博主允许不得转载. 为了达到软件注册,或者说软件和电脑绑定的目的,需要将电脑上的固定编号进行一系列的算法计算,并生成唯一和软件匹配的号码. 那么使用java如何达到这个目的呢? 通常做法都是通过java的Runtime来完成,通过 process的输入流,进行获取相关的信息. 下面列举具体的例子: 1.DiskUtils 获取硬盘编号 import …
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Management; namespace _17获取MAC地址 { class Program { static void Main(string[] args) { ManagementObjectSearcher nisc = new ManagementObjectSearcher("sele…
方法一:这种方式有一定的局限性,在Linux下的执行结果是:本机的IP = xxx/127.0.1.1 (其中xxx是你的计算机名) public void getLocalIPAddress() { try { InetAddress inetAddress = InetAddress.getLocalHost(); String localIP = inetAddress.getHostAddress().trim(); System.out.println(localIP); } catc…
import java.net.Inet6Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util…
   在项目中,时常需要获取本机的Ip或是Mac地址,进行身份和权限验证,本文就是通过java代码获取ip和Mac. package com.svse.query;import java.net.InetAddress;import java.net.NetworkInterface;import java.net.SocketException;import java.net.UnknownHostException; /*** * 获取本机的Mac地址 (物理地址) 如:58-02-E3-5…
java获取本机名称.IP.MAC地址和网卡名称 摘自:https://blog.csdn.net/Dai_Haijiao/article/details/80364370 2018年05月18日 14:53:19 阅读数:134 import java.net.InetAddress; import java.net.NetworkInterface; public class IpConfig { @SuppressWarnings("static-access") public…