Question

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?

Was it helpful?

Solution 2

From experimentation I've found that properties defined in extension files are under much stricter rules than the ones in the main jnlp file, and those not conforming to the rules are silently discarded.

OTHER TIPS

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, e.g.

<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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top