简体   繁体   中英

Java WebStart: <property ...> ignored when using <extension>?

I have a problem modernizing a Java WebStart application under Java 6 u 13 (the latest at this moment)

We desire to use the new mechanism to have several master configuration files each with their own configuration , which then "include" another jnlp file which is autogenerated to ensure that the jar list is accurate. After quite a bit of poking I have made it work, except for the fact that the properties defined in the master file is not available to the program when Main is invoked.

The master JNLP looks like (anonymized):

<jnlp>
  <information>
    <title>...</title>
    <vendor>...</vendor>
    <description>...</description>
    <description kind="short">...</description>
    <homepage href="http://....jnlp"/>
    <icon href="http://....gif"/>
    <!--          <offline-allowed/> -->
  </information>
  <security>
    <all-permissions/>
  </security>
  <resources>
    <j2se version="1.6+"/>
    <extension href="http://...extension.jnlp" />

    <property name="server.name" value="SERVER"/>
  </resources>
  <application-desc main-class="Main"/>
</jnlp>

and the extension.jnlp looks like:

<!-- Generated automatically.  Do not edit! -->
<jnlp>
  <information>
    <title>extension built 2009-04-22 12:39:58 CEST</title>
    <vendor>...</vendor>
  </information>
  <security><all-permissions/></security>
  <resources>
    <jar href="A.jar" />
    <jar href="B.jar" />
    <jar href="logback-classic-0.9.14.jar" />
    <jar href="logback-core-0.9.14.jar" />
    <jar href="slf4j-api-1.5.6.jar" />
  </resources>
  <component-desc />
</jnlp>

I have tried putting the proprty in the extension.jnlp too. Did not help. The JVM is reused and not relaunched according to the log in the Java Plugin Console.

Any suggestions?

I was struggling with the very same problem.
When I moved <property> element to an extension jnlp then it available for the application using System.getProperty() .

But it is not a solution for me as I wanted to have extension jnlp with all the jars and and properties defined in a mastet jnlp.

It appears that,

For an untrusted application, system properties set in the JNLP file will only be set by Java Web Start if they are considered secure.

If one wants to pass own properties to the VM, then their names have to begin with javaws. or jnlp. . Such properties are considered as secure. The <property> element has to contain value attribute, eg

<property name="jnlp.my.property" value="a value" />

Links:

  1. http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html#resources
  2. http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/settingArgsProperties.html

通过实验,我发现扩展文件中定义的属性比主 jnlp 文件中的属性遵循更严格的规则,那些不符合规则的属性会被悄悄丢弃。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM