Java - 如何在JNLP文件中自动获取IP地址? [英] Java - how to get IP address automaticallly in JNLP file?

查看:91
本文介绍了Java - 如何在JNLP文件中自动获取IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JNLP文件中,如何自动获取IP地址?示例:

In the JNLP file how do I get the IP address automatically? Example:

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="GET ip address here automatically" href="Test.jnlp">

而不是手动将地址设置为: codebase =http:// 10.10.10.1 /

instead of manually setting the address to: codebase="http://10.10.10.1/"

推荐答案

它无法做到。

您可以为 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.

这篇关于Java - 如何在JNLP文件中自动获取IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆