InetAddress.getLocalHost().getHostName()
と
Runtime.getRuntime().exec("hostname")
のどちらでも取得出来るが、
InetAddress.getLocalHost().getHostName()
の方が環境が変わっても正しく動く可能性が高い。
参考:
InetAddress.getLocalHost().getHostName()
と
Runtime.getRuntime().exec("hostname")
のどちらでも取得出来るが、
InetAddress.getLocalHost().getHostName()
の方が環境が変わっても正しく動く可能性が高い。
参考: