![获取电脑 ip 地址 及系统 获取电脑 ip 地址 及系统](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
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());
}