User Tools

Site Tools


java:jws

Java Web Start a.k.a. JNLP

.jnlp Example

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc.//DTD JNLP 1.5//EN" "http://www.netbeans.org/jnlp/DTD/jnlp.dtd">
<jnlp codebase="http://ieg.ifs.tuwien.ac.at/projects/VisualizingPatientCohorts/downloads/" 
  href="http://ieg.ifs.tuwien.ac.at/projects/VisualizingPatientCohorts/downloads/anscp.jnlp">
  <information>
    <title>Animated Scatter Plot</title>
    <vendor>Vienna University of Technology, Danube University Krems</vendor>
    <homepage href="http://ieg.ifs.tuwien.ac.at/projects/VisualizingPatientCohorts/"/>
    <description>Visualizing Patient Cohorts by Animated Scatter Plots</description>
    <icon href="default"/>
    <shortcut online="true"/>
  </information>
  <security>
    <all-permissions/>
  </security> 
  <resources>
    <j2se href="http://java.sun.com/products/autodl/j2se" version="1.6+"/>
    <jar href="anscp-2.0.1.jar" main="true"/>
    <jar href="log4j-1.2.15.jar"/>
  </resources>
  <application-desc main-class="main.Main">
    <argument>-data</argument>
    <argument>http://ieg.ifs.tuwien.ac.at/projects/VisualizingPatientCohorts/downloads/diabetes-real-ano-en.txt</argument>
  </application-desc>
</jnlp>

JAXB

Problem: JAXB requires (some) reflection

Solution: you need security permissions in .jnlp file

References: http://tech.javayogi.com/blogs/blog4.php/2010/08/23/jaxb-jax-ws-web-services-with-unsinged-java-applet

Resources

Problem: ClassLoader.getSystemResourceAsStream(str) does not work

Solution: use Thread.currentThread().getContextClassLoader().getResource(str).openStream() instead

Reference: http://forums.sun.com/thread.jspa?threadID=5305945

Sign JAR file

keytool -genkeypair -validity 900
 
jarsigner anscp-2.0.1.jar mykey

Note:

  • default validity is only 6 months
  • mykey is default alias
  • you need to sign all .jar files

jnlp href Attribute

Problem: You might want to move your files to another server or path. However, Java WS keeps track of known apps. These are identified by the jnlp href Attribute.

Solution: (1) do not use href; (2) code complete url in href; (3) build .jnlp file dynamically; (4) ???

Reference: http://download.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/faq.html#225, http://lopica.sourceforge.net/faq.html#relcodebase

java/jws.txt · Last modified: 2010/10/27 19:42 by Alexander Rind

alex @ ieg: home about me publications research