简体   繁体   中英

How to use JNLP without codebase?

we have an application that will be deployed on serveral servers with different IPs. The JNLP are generated at build time. Therefore we defined the JNLP without codebase:

<jnlp spec="1.0+" href="app.jnlp">

However, when starting this application a second time (from the Desktop icon that was created on the first startup) the codebase is set to the local filesystem which is absolutely useless. I would expect that Java Webstart sets the codebase with the actual origin address when starting the Application the first time. This does not seem to be true.

How can I prepare a generic JNLP that is usable without modification on different servers?

The JnlpDownloadServlet available in the sample/jnlp/servlet directory of the JDK, can be used to generate the JNLP from a template at runtime, inserting the correct codebase eg:

<jnlp spec="1.0+" codebase="$$codebase" href="app.jnlp">

Mojohaus provided a mavenized package of the servlet here .

You also need to provide an JNLP-INF/APPLICATION_TEMPLATE.JNLP file in the signed main jar. This duplicates your app.jnlp but has an asterisk for the $$codebase:

<jnlp spec="1.0+" codebase="*" href="app.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