且构网

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

Java - 如何在JNLP文件中自动获取IP地址?

更新时间:2023-01-08 23:19:27

它无法做到。

您可以为 10.10.10.1 添加DNS条目,并将主机名放在该字段而不是IP地址中,但它只是XML - 没有办法从该行调用方法来运行代码并找出它应该连接到的IP地址。

You can add a DNS entry for 10.10.10.1, and put the hostname in that field instead of the IP address, but it's just XML - there's no way to call a method from that line to run code and figure out what IP address it should connect to.