获取电脑 ip 地址 及系统
public static void main(String[] args) throws UnknownHostException {
//获取电脑系统 结果:os.name:Windows 10
String property = System.getProperty("os.name");
System.out.println("os.name:" + property);
//获取ip 地址
InetAddress localHost = InetAddress.getLocalHost();
System.out.println("HostAddress:" + localHost.getHostAddress());
//获取主机名称
System.out.println("HostName:" + localHost.getHostName());
}