在Java中查找物理机器名称 [英] Find physical machine name in Java

查看:156
本文介绍了在Java中查找物理机器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取运行我的jvm的物理机器名?

How can I obtain the physical machine name that my jvm is running in?

(物理=操作系统,直到vmware ......)

(Physical = OS, up to vmware...)

从海报评论中添加:

我的意思是运行JVM的计算机的名称。很可能是物理计算机,但如果JVM在另一个虚拟机内部运行,然后该名称很好。

Added from poster's comment:
I mean the name of the computer the JVM is running in. Most likely a physical computer, but if the JVM is running inside another virtual machine then that name is good.

推荐答案

String computername=InetAddress.getLocalHost().getHostName();
System.out.println(computername);

这篇关于在Java中查找物理机器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆