6 Replies Latest reply on Jan 15, 2012 11:21 AM by 911060

    dynamic parameters for Webstart


      I want to create a Webstart-Application that dynamically takes parameters. Looking for a solution I found that the only way seems to be to generate jnlp-files (e.g. using servlets). However, here at the Oracle-pages I found this document


      it says

      1. Example 5-11 Canonical Link to Launch a Web Start Application

      a href="my.jnlp"
      onclick="dtjava.launch(new dtjava.App('my.jnlp'));
      return false;">Launch me!</a>

      2. Example 5-1 Creating a dtjava.App Object

      var app = new dtjava.App(
      id: 'testApp',
      width: 100,
      height: 100,
      params: { 'variable': 'value'}

      So, I guess it should work.

      But it doesn't. Starting the application embedded in the browser works well.

      Does anyone know if this is possible at all or if generating the jnlp-file is really the only solution?

        • 1. Re: dynamic parameters for Webstart
          I haven't looked at this since jfx came along so perhaps they've added something but in classic jnlp this is not really supported (afaik).

          With desktop install the jnlp is copied and cached on the local system so next time it runs it uses that local cache, which means the 'params' are the ones that were generated on first launch.

          This is pretty annoying since hyperlinking to application content is ubiquitous these days for web apps and there's an expectation from users that desktops should do the same.

          Possibly an option is to do it via the embedded mode and just Popup a new stage (if you want it in its own window). I haven't tried that, so not sure what happens if you kill the browser it was launched from.

          A hack I did years ago was to have my servlet (that generates the jnlp) store the URL parameters for the calling ip address and then when the app started it called onto the servlet to get those parameters for it's ip. A horrible cludge but it got me through at the time.
          1 person found this helpful
          • 2. Re: dynamic parameters for Webstart
            Thank you! Your answer just confirms that there's no simple way to make the Webstart-version work. Since the servlet hack sounds to difficult to me and I just need a full-screen version, I am now trying to start the standalone via php. Just my php does not yet recognize java (exec('java -version') gives no result. So, I have a long night before me :-).
            • 3. Re: dynamic parameters for Webstart
              perhaps they have added something
              Exactly. They have added the DeployJava Toolkit the OP is using. None of your comments therefore apply.

              @OP: it should work. make sure your JNLP file either contains a valid href attribute or none. Try the JWS forum.
              1 person found this helpful
              • 4. Re: dynamic parameters for Webstart
                Waaahh. But thank you! So I will start trying again. Would anyone have a look at my code? The jnlp-file is generated by NetBeans Dev:
                <?xml version="1.0" encoding="utf-8"?>
                <jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="PillBox.jnlp">
                    <description>Sample JavaFX 2.0 application.</description>
                  <resources os="Windows">
                    <jfx:javafx-runtime version="2.0+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
                    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
                    <jar href="PillBox.jar" size="1965165" download="eager" />
                    <jar href="lib/mysql-connector-java-5.1.13-bin.jar" size="753542" download="eager" />
                  <applet-desc  width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback"  name="PillBox" />
                  <jfx:javafx-desc  width="800" height="600" main-class="pillbox.PillBox"  name="PillBox" >
                   <fx:param name="p4" value="true"/>
                    <fx:param name="p3" value="4"/>
                    <fx:param name="p2" value="500"/>
                    <fx:param name="p5" value="true"/>
                    <fx:param name="p1" value="500"/>
                  <update check="background"/>
                in the html file, I have the script
                   <!--javascript für webstart-->
                   <SCRIPT src="./web-files/dtjava.js"></SCRIPT>
                     function launchApplication(jnlpfile) {
                        var app = new dtjava.App(
                              width: 500,
                              height: 500,
                              params: { 'p1': '100',
                                        'p2': '100',
                                        'p3': '3',
                        return false;
                and the call
                <td align="center" valign="middle"><input style="height: 80px; width: 250px" type="button" value="Simulation mit Webstart starten"
                onClick="return launchApplication('PillBox.jnlp');"></td>
                I tried several variations. " instead of ' and deleting '. Deleting the parameter tags in the jnlp-file. I have no idea what to try next.

                Edited by: 908057 on 14.01.2012 17:48
                • 5. Re: dynamic parameters for Webstart
                  Define 'doesn't work'.
                  • 6. Re: dynamic parameters for Webstart
                    The java-application starts with the parameters defined in the jnlp-file, not with the parameters defined in the script.

                    If I delete the parameters from the jnlp-file, the java-applications starts with saying that there are no parameters:
                    "getParameters().getRaw().size() : "+getParameters().getRaw().size() , "", JOptionPane.OK_CANCEL_OPTION);