且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java getLocalHost()UnknownHostException/etc/hosts文件与linux api不同吗?

更新时间:2023-11-25 19:59:22

嗯,我偶然发现了两者之间的区别.在我的/etc/sysconfig/network文件中,我在工作计算机上具有FQDN,但在另一台计算机上,我只有主机名"b",因此将其更改为"b.domain.com"可以解决此问题,而我没有这样做.根本不需要修改我的/etc/hosts文件!!!!

ah, I stumbled upon the difference. In my /etc/sysconfig/network file, I had the FQDN on the working machine but on the other machine, I only had the hostname "b" so changing that to "b.domain.com" fixed the issue and I don't need to modify my /etc/hosts file at all!!!!

迪恩