ファイルC:\WINDOWS\system32\drivers\etc\hostsには、次の行しかありません
192.168.0.23 computername.domain.com computername
私が走るとき
InetAddress localhost = InetAddress.getLocalHost();
System.out.println("getLocalHost:" + localhost);
私は出力が
getLocalHost:computername/192.168.0.23
しかし、それは
getLocalHost:computername/192.168.0.107
なぜこれが起こるのかについてのアイデアはありますか?他のファイルで構成を行う必要がありますか?
編集
InetAddress.getByName('computername')
と同じ IP を生成getLocalHost()
します。