Java: InetAddress.getLocalHost();抛出 java.net.UnknownHostException

Java: InetAddress.getLocalHost(); throws java.net.UnknownHostException

我有一个问题 运行 我的 Java 应用程序: 执行以下行时,它抛出异常:

InetAddress.getLocalHost();

抛出以下异常:

java.net.UnknownHostException: ????????: ????????
at java.net.InetAddress.getLocalHost(InetAddress.java:1506)
at main.Main.main(Main.java:23)
Caused by: java.net.UnknownHostException: ????????
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
at java.net.InetAddress.getLocalHost(InetAddress.java:1501)
... 1 more

我知道这是我本地机器的问题,因为它可以在我的虚拟机和其他设备上运行。我正在使用 Windows 10 并且我的主机文件是默认文件(未编辑)。问号是什么意思?我可以尝试解决这个问题吗?

我知道问题出在哪里了:我的主机名由西里尔字母组成。 Discord 上的一位用户是这样向我解释的:

this seems to be a limitated at the C function getaddrinfofunction [12:14] which does make sense, considering cyrillic isn't a valid DNS name, so it's following RFC. [12:14] (even though hostname != dns name techically, but nuances). [12:15] RFC 952 and RFC 1123 have details info on it