Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8166438

New-style module arguments are allowed only using alternate form in webstart where both forms are allowed from command line

XMLWordPrintable

    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+135)
      Java HotSpot(TM) Server VM (build 9-ea+135, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      According to JEP-261 http://openjdk.java.net/jeps/261 arguments related to tweaking of the module system can be specified as
      --add-exports <source-module>/<package>=<target-module>(,<target-module>)*
      or
      --add-modules <module>(,<module>)*

      These options work when launching a Java application from the command line.

      However, when launching from a Web Start file I seem to have to specify as
      --add-exports=<source-module>/<package>=<target-module>(,<target-module>)*
      or
      --add-modules=<module>(,<module>)*

      (Note the extra '=' character)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Deploy a web start application necessitating extra module startup options (example attached). (Our application is deployed as a signed JAR file with a DRS 'run' rule but I don't think this makes any difference to this bug)
      2. Launch it

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The application should fail to launch when module options are not specified
      The application should launch correctly when module options are correctly specified
      ACTUAL -
      The application failx to launch when module options are not specified (good)
      The application does not launch correctly, even if module options are correctly specified (bad)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      test.jnlp
      =========

      <?xml version="1.0" encoding="utf-8"?>
      <jnlp spec="6.0+" codebase="http://www.example.com/webstart" href="test.jnlp">
      <information>
            <title>Test app</title>
            <vendor>Anon</vendor>
            <offline-allowed/>
          </information>
          <security>
              <all-permissions/>
          </security>
          <update check="always" policy="always" />
          <resources>
            <j2se version="1.8+" java-vm-args="--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-modules java.se.ee"/>
            <jar href="test.jar" main="true"/>
          </resources>

          <application-desc main-class="Toto"/>
        </jnlp>

      Toto.java
      =========

      import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
      import javax.swing.UIManager;
      import javax.xml.bind.JAXBException;
      import java.text.*;
      import java.util.*;

      public class Toto {
        public static void main(String... argv) throws Exception {
              if (UIManager.getLookAndFeel() instanceof WindowsLookAndFeel) System.out.println("Using Windows L&F");
              new JAXBException("Testing").printStackTrace();
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Specify module options incorrectly as
       java-vm-args="--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-modules=java.se.ee"

      I haven't tested other module options (limit-modules, add-reads, etc., etc.) but of course all options specified in JEP-261 which are allowed for Web Start applications should be handled correctly.

        1. test.jnlp
          0.6 kB
          Pardeep Sharma

            herrick Andy Herrick (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: