自Java 7u40中的最后一次安全性更改以来,需要对JNLP文件进行签名.这可以通过在JNLP-INF/APPLICATION.JNLP中添加最终JNLP ,或通过在签名主jar 中的JNLP-INF/APPLICATION_TEMPLATE.JNLP中提供模板JNLP来完成.
第一种方法效果很好,但我们希望允许将以前未知数量的运行时参数传递给我们的应用程序.
因此,我们的APPLICATION_TEMPLATE.JNLP如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="*">
<information>
<title>...</title>
<vendor>...</vendor>
<description>...</description>
<offline-allowed />
</information>
<security>
<all-permissions/>
</security>
<resources>
<java version="1.7+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="launcher/launcher.jar" main="true"/>
<property name="jnlp...." value="*" />
<property name="jnlp..." value="*" />
</resources>
<application-desc main-class="...">
*
</application-desc>
</jnlp>
Run Code Online (Sandbox Code Playgroud)
问题是application-desc标签内部的*.
可以使用多个参数标记对固定数量的参数进行通配符(参见下面的代码),但是不可能为应用程序提供更多或更少的参数(Java Webstart不会以空参数标记开头).
<application-desc main-class="...">
<argument>*</argument>
<argument>*</argument>
<argument>*</argument>
</application-desc>
Run Code Online (Sandbox Code Playgroud)
有人可以确认此问题和/或是否有将先前未定义的运行时参数传递给Java应用程序的解决方案?
非常感谢!